/* styles.css */

/* === Global Reset & Typography === */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: 'Orbitron', sans-serif;
}

h1, h2, h3, .navbar .logo {
  font-weight: 700;
}

body {
  /* fallback color */
  background-color: #1C2733;

  /* full‐screen image */
  background-image: url('/images/bg.jpg');
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;

  /* optional: lock the image in place */
  background-attachment: fixed;
}

/* === Color Variables === */
:root {
  --primary: #1C2733;   /* royal blue */
  --accent:  #B85C38;   /* bright gold */
  --dark:    #222222;
  --light:rgb(56, 56, 56);
}

/* === Navigation Bar === */
.navbar {
  display: flex;
  align-items: center;
  background: var(--primary);
  padding: 0.5em 1em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.navbar .logo {
  font-size: 1.4em;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
  margin-right: 2em;
}
.navbar ul {
  list-style: none;
  display: flex;
  gap: 1em;
  flex: 1;
}
.navbar ul li {
}
.navbar ul li a {
  color: #fff;
  text-decoration: none;
  padding: 0.4em 0.8em;
  border-radius: 4px;
  transition: background 0.2s;
}
.navbar ul li a:hover,
.navbar ul li a.active {
  background: var(--accent);
  color: var(--dark);
}

/* === Navbar layout updated === */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--primary);
  padding: 0.5em 1em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.nav-left {
  display: flex;
  gap: 1em;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.8em;
}

.avatar-link {
  display: inline-block;
  border-radius: 50%;
  overflow: hidden;
  width: 40px;
  height: 40px;
  border: 2px solid var(--accent);
}

/* On desktop, avatar is in nav-right flow */
@media (min-width: 769px) {
  .navbar .avatar-link {
    position: static;
  }
  
  .navbar {
    padding-right: 1em; /* Reset to normal padding on desktop */
  }
}

.avatar-link img.avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.btn-logout {
  background: var(--accent);
  color: var(--dark);
  border: none;
  padding: 0.4em 0.8em;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
}
.btn-logout:hover {
  background: #fff;
  color: var(--accent);
}

/* === Utility Classes & Buttons === */
.text-accent    { color: var(--accent); }
.bg-primary     { background-color: var(--primary); }
.bg-accent      { background-color: var(--accent); }
.btn {
  display: inline-block;
  padding: 0.5em 1em;
  border-radius: 4px;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s ease;
}
.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  transform: scale(1.05);
}
.btn-accent {
  background: var(--accent);
  color: var(--dark);
}
.btn-accent:hover {
  transform: scale(1.05);
}

/* === Login / Signup Pages === */
.form-container {
  max-width: 360px;
  margin: 5em auto;
  background: rgba(255,255,255,0.9);
  padding: 2em;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.form-container input {
  width: 100%;
  padding: 0.6em;
  margin-top: 0.5em;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.form-container .btn {
  width: 100%;
  margin-top: 1em;
}

body.signup-page,
body.login-page {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;  /* let the ::before image show */
}

body.signup-page::before,
body.login-page::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url('/images/bg.jpg') center/cover no-repeat fixed;
  opacity: 0.3;
  z-index: -1;
}

/* Panel overrides */
body.signup-page .form-container,
body.login-page .form-container {
  margin: 0;              /* no 5em top gap */
  color: var(--dark);     /* dark text inside */
}

body.signup-page nav.navbar,
body.login-page nav.navbar {
  position: absolute;
  top: 0; 
  left: 0; 
  right: 0;
  z-index: 2;      /* keep it on top */
}

/* Now center the form-container as a flex child of the body,
   ignoring the absolutely-positioned nav. */
body.signup-page,
body.login-page {
  display: flex;
  flex-direction: column;
  justify-content: center;  /* vertical centering */
  align-items: center;      /* horizontal centering */
}

/* Push the form down so it doesn’t sit *under* the navbar */
body.signup-page .form-container,
body.login-page .form-container {
  margin-top: 3.5em;  /* match nav height (~3.5rem) */
}

/* Center-text helper */
.center-text {
  text-align: center;
}

/* === Hero & Dashboard === */
.hero {
  background: var(--primary);
  color: #ffffff;
  padding: 2em;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  opacity: 0.15;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
}
.hero h1 {
  font-size: 2.5em;
  margin-bottom: 0.5em;
}
.hero .date-tag {
  display: inline-block;
  background: var(--accent);
  color: var(--dark);
  padding: 0.2em 0.6em;
  border-radius: 4px;
  margin-top: 0.5em;
}

/* === Riders grid & cards === */
.riders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px,1fr));
  gap: 1em;
  margin-top: 1em;
  padding: 0;
}

.rider-card {
  background: var(--light);
  border-radius: 8px;
  padding: 0.5em;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rider-card img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.5em;
}

.rider-card .name {
  font-weight: bold;
  color: var(--dark);
  font-size: 0.9em;
}

/* Make “no leagues” message stand out */
#noLeagueMsg {
  /* semi-opaque dark background so text pops over the page image */
  background: rgba(0, 0, 0, 0.6);
  padding: 1em;
  border-radius: 6px;
  margin: 1em;           /* give it some breathing room */
}

#noLeagueMsg p {
  /* light, slightly larger text with a little glow */
  color: #fff;
  font-size: 1.2rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  line-height: 1.4;
  margin: 0;
}

/* Stat tiles */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5em;
  margin: 2em 0;
}

.stat-tile {
  background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
  border: none;
  padding: 2em 1.5em;
  text-align: center;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
}

.stat-tile:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
}

.stat-tile .icon {
  font-size: 2.5em;
  color: var(--accent);
  margin-bottom: 0.5em;
  display: block;
}

.stat-tile h3 {
  margin: 0.5em 0 0 0;
  font-size: 1.4em;
  color: var(--primary);
  font-weight: 700;
}

.stat-tile .stat-value {
  font-size: 2.2em;
  font-weight: 800;
  color: var(--primary);
  margin: 0.3em 0;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.stat-tile .stat-label {
  font-size: 0.9em;
  color: #666;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* === Tables & Scoreboards === */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1em;
}
th, td {
  padding: 0.6em;
  border: 1px solid #ccc;
}
th {
  background: var(--primary);
  color: #fff;
  text-transform: uppercase;
  font-size: 0.9em;
}
tr:nth-child(even) {
  background: var(--light);
}

/* Draft page scoreboard style */
.draft-table th,
.draft-table td {
  font-family: 'Courier New', monospace;
  font-size: 1em;
}
.current-pick {
  animation: flash 1s ease-in-out infinite;
  border-left: 4px solid var(--accent);
}
@keyframes flash {
  0%, 100% { background: var(--light); }
  50%      { background: var(--accent); }
}

/* Countdown timer as sports clock */
.timer {
  font-family: 'Digital-7 Mono', monospace;
  font-size: 2em;
  color: var(--accent);
  background: #000;
  padding: 0.2em 0.6em;
  display: inline-block;
  border-radius: 4px;
}

/* === Admin Panel === */
.admin-tabs {
  display: flex;
  gap: 0.5em;
  margin-bottom: 1em;
}
.admin-tabs button {
  flex: 1;
  background: var(--light);
  border: 2px solid var(--primary);
  border-radius: 4px;
  padding: 0.6em;
  position: relative;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.admin-tabs button.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 8px var(--accent);
}
.admin-tabs button.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 20px;
  height: 6px;
  background: var(--accent);
  transform: translateX(-50%);
}

/* Form styling in admin */
.admin-form input,
.admin-form select {
  width: 100%;
  margin-top: 0.4em;
  margin-bottom: 1em;
}

.admin-form input {
  padding: 0.5em;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.admin-form select {
  /* Inherits the modern styling from the base select rules above */
}

/* === Team & Leaderboard === */
.podium {
  display: flex;
  justify-content: center;
  margin: 2em 0;
}
.podium .position {
  text-align: center;
  margin: 0 1em;
}
.podium .position .number {
  font-size: 3em;
  color: var(--accent);
}
.leaderboard-logo {
  width: 32px;
  vertical-align: middle;
  margin-right: 0.5em;
}

/* === Team Page === */
.team-section {
  margin: 2em 1em;
}
.team-section h3 {
  color: var(--accent);
  margin-bottom: 0.5em;
}
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1em;
}
.team-card {
  background: var(--light);
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 1em;
  text-align: center;
  color: var(--dark);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.team-card img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  margin-bottom: 0.5em;
}
.team-card .name {
  font-weight: bold;
  margin-bottom: 0.25em;
}
.team-card .team {
  font-size: 0.85em;
  color: var(--accent);
  font-weight: bold;
  margin-bottom: 0.25em;
}
.team-card .points {
  font-size: 1.1em;
}

/* League headings: white + shadow for legibility */
.team-section h3 {
  color: #fff !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

/* Rider name & points in true black */
.team-card .name,
.team-card .points {
  color: #fff !important;
}

/* === Leaderboard Sections === */
.leaderboard-section {
  margin: 2em 1em;
  background: rgba(0,0,0,0.4);
  padding: 1em;
  border-radius: 8px;
}
.leaderboard-section h3 {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  margin-bottom: 0.5em;
  font-size: 1.4em;
}

/* Tables inside leaderboard sections - DEFAULT DESKTOP */
.leaderboard-section table {
  width: 100%;
  border-collapse: collapse;
  display: table; /* Normal table display by default */
}
.leaderboard-section th,
.leaderboard-section td {
  padding: 0.6em;
  border: 1px solid #555;
  text-align: center;
}
.leaderboard-section th {
  background: var(--accent);
  color: var(--dark);
  text-transform: uppercase;
  font-size: 0.9em;
}
.leaderboard-section tr:nth-child(even) {
  background: rgba(255,255,255,0.1);
}
.leaderboard-section td {
  color: #eee;
}

/* Hide mobile cards by default */
.mobile-leaderboard {
  display: none;
}

/* ================================================
   MOBILE (<= 600px)
   ================================================ */
@media (max-width: 600px) {
  /* Navbar stacks vertically */
  .navbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5em;
  }
  .navbar .logo {
    margin-bottom: 0.5em;
  }
  .navbar ul {
    flex-direction: column;
    width: 100%;
    gap: 0;
  }
  .navbar ul li a {
    display: block;
    width: 100%;
    padding: 0.8em 0.5em;
  }

  /* Hero text smaller */
  .hero h1 {
    font-size: 1.8em;
  }
  .hero .date-tag {
    font-size: 0.9em;
    padding: 0.2em 0.4em;
  }

  /* Single-column grids */
  .stats-grid,
  .riders-grid,
  .team-grid {
    grid-template-columns: 1fr !important;
  }

  /* Make all .form-container & .btn full-width */
  .form-container {
    width: 90%;
    margin: 2em auto;
    padding: 1em;
  }
  .form-container .btn,
  .btn {
    width: 100%;
    margin: 0.5em 0;
  }

  /* Default: Hide mobile cards, show table */
  .mobile-leaderboard {
    display: none;
  }
  
  .leaderboard-section table {
    display: table;
    width: 100%;
  }

  /* Collapse quick-links into vertical stack */
  section[style*="padding: 1em;"] .btn {
    display: block;
  }
}

/* Tables become horizontally scrollable on medium mobile devices (601px - 768px) */
@media (min-width: 601px) and (max-width: 768px) {
  .leaderboard-section table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .leaderboard-section th, 
  .leaderboard-section td {
    white-space: nowrap;
  }
}

/* Mobile-friendly leaderboard cards for smaller screens - v2 */
@media (max-width: 600px) {
  .leaderboard-section table {
    display: none !important; /* Hide the table */
  }
  
  .leaderboard-section {
    margin: 1em 0.5em;
    padding: 0.8em;
  }
  
  /* Show mobile leaderboard cards */
  .mobile-leaderboard {
    display: block !important;
  }
  
  .mobile-team-card {
    background: rgba(255,255,255,0.1);
    border: 1px solid #555;
    border-radius: 8px;
    margin-bottom: 0.8em;
    padding: 0.8em;
    position: relative;
  }
  
  .mobile-team-card:nth-child(even) {
    background: rgba(255,255,255,0.15);
  }
  
  .mobile-team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5em;
    border-bottom: 1px solid #666;
    padding-bottom: 0.5em;
  }
  
  .mobile-place {
    background: var(--accent);
    color: var(--dark);
    border-radius: 50%;
    width: 2em;
    height: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9em;
  }
  
  .mobile-team-info h4 {
    color: #fff;
    margin: 0;
    font-size: 1em;
  }
  
  .mobile-team-info p {
    color: #ccc;
    margin: 0;
    font-size: 0.85em;
  }
  
  .mobile-combined-score {
    background: var(--primary);
    color: #fff;
    padding: 0.3em 0.6em;
    border-radius: 4px;
    font-weight: bold;
    font-size: 1.1em;
  }
  
  .mobile-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5em;
    margin-bottom: 0.5em;
  }
  
  .mobile-stat {
    text-align: center;
    background: rgba(0,0,0,0.3);
    padding: 0.4em;
    border-radius: 4px;
  }
  
  .mobile-stat-label {
    color: #aaa;
    font-size: 0.7em;
    text-transform: uppercase;
    margin-bottom: 0.2em;
  }
  
  .mobile-stat-value {
    color: #fff;
    font-weight: bold;
    font-size: 0.9em;
  }
  
  .mobile-view-team {
    width: 100%;
    background: var(--accent);
    color: var(--dark);
    border: none;
    padding: 0.5em;
    border-radius: 4px;
    font-weight: bold;
    margin-top: 0.3em;
  }
}

/* === Admin Panel Enhancements === */

/* Tab bar styling */
.admin-tabs {
  background: var(--dark);
  padding: 0.5em 1em;
  border-radius: 8px;
  display: flex;
  gap: 0.5em;
  margin-bottom: 1em;
}

.admin-tabs button {
  flex: 1;
  background: var(--light);
  border: none;
  padding: 0.75em 1em;
  font-weight: bold;
  color: #fff;
  border-radius: 4px;
  transition: background 0.2s, transform 0.1s;
}

.admin-tabs button:hover {
  background: var(--accent);
  transform: translateY(-2px);
}

.admin-tabs button.active {
  background: var(--accent);
  color: var(--dark);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Tab content wrapper */
.tab {
  background: rgba(0,0,0,0.4);
  padding: 1em;
  border-radius: 8px;
  margin: 0 1em 2em;
  color: #fff;
}

/* Table styling */
.tab table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1em;
}

.tab th,
.tab td {
  padding: 0.75em 1em;
  text-align: left;
}

.tab thead {
  background: var(--primary);
}

.tab thead th {
  color: #fff;
  font-weight: normal;
  text-transform: uppercase;
  font-size: 0.9em;
}

.tab tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.05);
}

.tab tbody tr:hover {
  background: rgba(255,255,255,0.1);
}

.tab tbody td {
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* Action buttons in tables */
.tab .actions button {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.3em 0.6em;
  border-radius: 4px;
  margin-right: 0.3em;
  font-size: 0.9em;
  transition: background 0.2s, color 0.2s;
}

.tab .actions button:hover {
  background: var(--accent);
  color: var(--dark);
}

/* Form styling */
.admin-form {
  background: rgba(255,255,255,0.1);
  padding: 1em;
  border-radius: 8px;
  margin-top: 1.5em;
}

.admin-form h3 {
  margin-bottom: 0.75em;
  color: var(--accent);
}

.admin-form label {
  display: block;
  margin-bottom: 0.75em;
  font-size: 0.95em;
}

.admin-form input,
.admin-form select {
  width: 100%;
  margin-top: 0.3em;
}

.admin-form input {
  padding: 0.6em;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  background: rgba(0,0,0,0.2);
  color: #fff;
  font-size: 0.95em;
}

.admin-form select {
  /* Inherits the modern styling from the base select rules above */
}

.admin-form input::placeholder {
  color: rgba(255,255,255,0.6);
}

.admin-form button {
  margin-top: 1em;
  width: auto;
  padding: 0.6em 1.2em;
}

/* Scroll within tabs if data is tall */
.tab {
  max-height: 70vh;
  overflow-y: auto;
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .admin-tabs {
    flex-direction: column;
  }
  .tab {
    margin: 1em;
  }
  .tab table, .admin-form {
    font-size: 0.9em;
  }
}

/* make the countdown stand out in the hero */
.timer {
  font-family: 'Digital-7 Mono', monospace;
  font-size: 1.2em;
  background: var(--accent);
  color: var(--dark);
  padding: 0.4em 0.8em;
  border-radius: 4px;
  display: inline-block;
}

.hero .date-tag,
.hero .timer {
  display: block;
  margin: 0.5em auto;
}

.pool-card {
  background: var(--light);
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 1em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  color: var(--dark);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.pool-card img {
  width: auto;              /* scale naturally */
  max-width: 100%;          /* never exceed card width */
  height: auto;             /* keep aspect ratio */
  max-height: 120px;        /* cap height so tall images don’t overflow */
  display: block;
  margin: 0 auto 0.5em auto; /* center horizontally */
  object-fit: contain;      /* make sure whole image fits */
}

.pool-card .name {
  font-weight: bold;
  margin-bottom: 0.5em;
}

.pool-card button {
  margin-top: auto;
  background: var(--accent);
  color: var(--dark);
  border: none;
  padding: 0.4em 0.8em;
  border-radius: 4px;
  cursor: pointer;
}
.pool-card button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.turn-banner {
  color: var(--accent);
  font-weight: bold;
}

/* styles.css */
.modal {
  display: none;                /* hidden by default */
  position: fixed;
  z-index: 1000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
}
.modal-content {
  background: var(--light);
  border-radius: 8px;
  padding: 1em;
  max-width: 600px;
  width: 90%;
  position: relative;
}
.close {
  position: absolute;
  top: 0.5em; right: 0.8em;
  font-size: 1.5em;
  cursor: pointer;
  color: #333;
}

/* ===== Profile Page ===== */
.profile-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2em 1em;
  background: transparent;
  min-height: 100vh;
}

.profile-page h1 {
  text-align: center;
  margin-bottom: 2em;
  font-size: 3rem;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  font-weight: 700;
}

.profile-card {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  box-shadow: none;
  padding: 2.5em;
  margin-bottom: 2em;
  border: none;
  backdrop-filter: none;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  color: #fff;
}

.profile-card:hover {
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.profile-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
}

.avatar-section {
  display: flex;
  align-items: center;
  gap: 2em;
  margin-bottom: 2em;
  padding-bottom: 2em;
  border-bottom: 2px solid #f0f0f0;
}

.avatar-section img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform 0.3s ease;
}

.avatar-section img:hover {
  transform: scale(1.05);
}

.avatar-section .btn {
  padding: 0.8em 1.5em;
  font-size: 0.95rem;
  border-radius: 25px;
  background: linear-gradient(135deg, var(--primary) 0%, #a91e3a 100%);
  border: none;
  color: white;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(139, 21, 56, 0.3);
}

.avatar-section .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(139, 21, 56, 0.4);
}

#profileDisplay {
  display: grid;
  gap: 1.5em;
}

#profileDisplay p {
  display: flex;
  align-items: center;
  gap: 1em;
  padding: 1em;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  border-left: 4px solid var(--accent);
  margin: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#profileDisplay p:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#profileDisplay strong {
  color: var(--primary);
  font-weight: 700;
  min-width: 120px;
  font-size: 0.95rem;
}

#profileDisplay span {
  color: #333;
  font-weight: 500;
}

.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.5em;
  color: var(--primary);
  font-size: 0.95rem;
}
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.6em;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

.button-group {
  display: flex;
  justify-content: flex-end;
  gap: 1em;
}

/* ---- Modal backdrop & centering ---- */
/* Modal base (hidden) */
.modal {
  display: none;            /* hidden by default */
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  /* no display:flex here */
}

/* When we want to show it, center via flex */
.modal.show {
  display: flex;            /* now visible and flex for centering */
  align-items: center;
  justify-content: center;
}

/* ---- Modal box ---- */
.modal-content {
  background: #fff;
  border-radius: 8px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* header with title and close button */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1em;
  border-bottom: 1px solid #eee;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

/* footer with action buttons */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5em;
  padding: 0.75em 1em;
  border-top: 1px solid #eee;
}

/* reuse your existing avatar-grid rules */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 1em;
  padding: 1em;
}

.avatar-grid img {
  width: 100%;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color .2s;
}

.avatar-grid img:hover {
  border-color: #aaa;
}

.avatar-grid img.selected {
  border-color: #007bff;
}

/* ── PROMO MODAL COMPLETE STYLES (placed here to override generic .modal-content) ── */
/* Ensure the modal container itself centers content */
#promoModal.modal.show {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  overflow: auto !important;
}

#promoModal.modal {
  display: none !important;
}

#promoModal.modal .modal-content {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%) !important;
  border-radius: 12px !important;
  max-width: 480px !important;
  width: 92% !important;
  padding: 0 !important;
  margin: 0 !important;
  position: relative !important;
  flex-shrink: 0 !important;
}

#promoModal.modal .modal-header {
  background: transparent !important;
  color: white !important;
  padding: 0.8em 1em !important;
  border-radius: 12px 12px 0 0 !important;
  border-bottom: 1px solid rgba(255,255,255,0.2) !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

#promoModal.modal .modal-header h2 {
  color: white !important;
  font-size: 1.3em !important;
  margin: 0 !important;
}

#promoModal.modal .modal-close {
  color: white !important;
  opacity: 0.9 !important;
  font-size: 1.8rem !important;
  font-weight: 300 !important;
  background: rgba(255,255,255,0.2) !important;
  border-radius: 4px !important;
  padding: 0.1em 0.35em !important;
  cursor: pointer !important;
  border: none !important;
  line-height: 1 !important;
  transition: all 0.2s ease !important;
}

#promoModal.modal .modal-close:hover,
#promoModal.modal .modal-close:active {
  opacity: 1 !important;
  background: rgba(255,255,255,0.3) !important;
}

#promoModal.modal .modal-body {
  text-align: center !important;
  padding: 1.5em !important;
  background: transparent !important;
}

#promoModal.modal .promo-code-box {
  background: rgba(255,255,255,0.15) !important;
  padding: 1.2em 1.5em !important;
  border-radius: 8px !important;
  margin: 0 0 1.2em 0 !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2) !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
}

#promoModal.modal .promo-code-label {
  color: #fff !important;
  font-size: 0.85em !important;
  margin-bottom: 0.3em !important;
  opacity: 0.9 !important;
  font-weight: 500 !important;
}

#promoModal.modal .promo-code-text {
  color: #fff !important;
  font-size: 2.2em !important;
  font-weight: bold !important;
  margin: 0 !important;
  letter-spacing: 4px !important;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
}

#promoModal.modal .promo-savings {
  color: white !important;
  margin-bottom: 1.2em !important;
  font-size: 1em !important;
  opacity: 0.95 !important;
  line-height: 1.4 !important;
}

#promoModal.modal .promo-upgrade-btn {
  font-size: 1.1em !important;
  padding: 0.85em 3em !important;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25) !important;
  background: #ff6b35 !important;
  border: none !important;
  color: white !important;
  font-weight: 600 !important;
  border-radius: 25px !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  min-width: 200px !important;
}

#promoModal.modal .promo-upgrade-btn:hover,
#promoModal.modal .promo-upgrade-btn:active {
  transform: translateY(-2px) !important;
  box-shadow: 0 5px 12px rgba(0,0,0,0.3) !important;
  background: #ff5722 !important;
}

#promoModal.modal .promo-dismiss-container {
  margin-top: 0.8em !important;
  font-size: 0.85em !important;
}

#promoModal.modal .promo-dismiss-link {
  color: rgba(255,255,255,0.8) !important;
  text-decoration: underline !important;
  padding: 0.4em 0.8em !important;
  display: inline-block !important;
  cursor: pointer !important;
}

#promoModal.modal .promo-dismiss-link:hover,
#promoModal.modal .promo-dismiss-link:active {
  color: white !important;
}

/* Mobile Promo Modal Overrides */
@media (max-width: 768px) {
  #promoModal.modal.show {
    padding: 15px !important;
  }

  #promoModal.modal.show .modal-content {
    width: 90% !important;
    max-width: 440px !important;
    margin: 0 auto !important;
  }

  #promoModal.modal .modal-header {
    padding: 1em 0.8em !important;
  }

  #promoModal.modal .modal-header h2 {
    font-size: 1.15em !important;
  }

  #promoModal.modal .modal-close {
    font-size: 2.2rem !important;
    padding: 0.2em 0.4em !important;
    min-width: 48px !important;
    min-height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255,255,255,0.25) !important;
  }

  #promoModal.modal .modal-close:active {
    background: rgba(255,255,255,0.4) !important;
    transform: scale(0.95) !important;
  }

  #promoModal.modal .modal-body {
    padding: 1.2em 1em 1em !important;
  }

  #promoModal.modal .promo-code-box {
    padding: 1em 0.8em !important;
    margin: 0 0 0.8em 0 !important;
  }

  #promoModal.modal .promo-code-text {
    font-size: 1.7em !important;
    letter-spacing: 2px !important;
  }

  #promoModal.modal .promo-savings {
    font-size: 0.85em !important;
    margin-bottom: 0.8em !important;
  }

  #promoModal.modal .promo-upgrade-btn {
    width: 100% !important;
    font-size: 1em !important;
    padding: 0.9em !important;
  }

  #promoModal.modal .promo-dismiss-link {
    padding: 0.6em 1em !important;
    min-height: 44px !important;
    font-size: 0.9em !important;
  }
}

@media (max-width: 480px) {
  #promoModal.modal.show {
    padding: 10px !important;
  }

  #promoModal.modal.show .modal-content {
    width: 92% !important;
    max-width: 400px !important;
    margin: 0 auto !important;
  }

  #promoModal.modal .modal-header h2 {
    font-size: 1.05em !important;
  }

  #promoModal.modal .promo-code-text {
    font-size: 1.5em !important;
    letter-spacing: 1.5px !important;
  }
}

/* ===== Profile Stats Strip ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1em;
  margin: 1.5em 0;
}

.stat-card {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  padding: 1.2em 1.5em;
  text-align: center;
  box-shadow: none;
  transition: all 0.3s ease;
  color: #fff;
  line-height: 1.8;
}

.stat-card:hover {
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #222;
}

.stat-label {
  margin-top: 0.25em;
  font-size: 0.85rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Modal team grid tweak */
#teamModalGrid.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1em;
  justify-items: center;
}

#teamModalGrid .team-card {
  background: var(--dark);
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 0.8em;
  text-align: center;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

#teamModalGrid .team-card img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
  margin-bottom: 0.5em;
}

.logo img,
.logo-img {
  height: 80px;    /* adjust as needed */
  width: auto;
  display: block;
}

.dashboard-three-col {
  display: flex;
  gap: 1em;
  padding: 1em;
}
.dashboard-section {
  flex: 1;
}

.dashboard-section h2 {
  color: #fff;
  text-align: center;
  margin-bottom: 0.5em;
}

.stats-panel {
  background: rgba(0, 0, 0, 0.5);
  padding: 1.2em 1.5em;
  border-radius: 8px;
  color: #fff;
  line-height: 1.8;  /* spacing between lines */
  font-size: 1em;
}

.stats-panel strong {
  color: var(--accent);
}

.riders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1em;
  justify-items: center;
}
.rider-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  text-align: center;
  background: rgba(0,0,0,0.5);
  max-width: 140px;
}

.rider-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* overlay the name */
.rider-card .name {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 0.3em 0.5em;
  font-size: 0.85em;
  font-weight: bold;
  text-align: center;
}

.events-stack {
  display: flex;
  flex-direction: column;
  gap: 1em;
}

.events-stack > div {
  background: rgba(0, 0, 0, 0.5);
}

.events-stack > div h3 {
  color: #fff;
}

.events-stack > div p {
  color: #fff;
}

label {
  color: #fff;
  font-weight: 600;
}

/* ===== MODERN DROPDOWN STYLING ===== */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: linear-gradient(135deg, #2a2a2a 0%, #3a3a3a 100%);
  border: 2px solid #555;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 40px 12px 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 44px;
  box-sizing: border-box;
  
  /* Custom dropdown arrow */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e05d00' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
}

select:hover {
  border-color: #e05d00;
  background: linear-gradient(135deg, #3a3a3a 0%, #4a4a4a 100%);
  box-shadow: 0 4px 12px rgba(224, 93, 0, 0.2);
  transform: translateY(-1px);
}

select:focus {
  outline: none;
  border-color: #e05d00;
  background: linear-gradient(135deg, #3a3a3a 0%, #4a4a4a 100%);
  box-shadow: 0 0 0 3px rgba(224, 93, 0, 0.3);
}

select:active {
  transform: translateY(0);
}

/* Dropdown options styling */
select option {
  background-color: #2a2a2a !important;
  color: #fff !important;
  padding: 8px 16px !important;
  border: none !important;
}

select option:hover,
select option:focus {
  background-color: #e05d00 !important;
  color: #fff !important;
}

select option:checked {
  background-color: #e05d00 !important;
  color: #fff !important;
  font-weight: bold !important;
}

/* Disabled state */
select:disabled {
  background: #1a1a1a;
  border-color: #333;
  color: #666;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
}

select:disabled:hover {
  border-color: #333;
  background: #1a1a1a;
  box-shadow: none;
  transform: none;
}

/* Small/compact dropdown variant */
select.compact {
  padding: 8px 32px 8px 12px;
  min-height: 36px;
  font-size: 0.9rem;
  background-size: 16px;
  background-position: right 8px center;
}

/* Large/prominent dropdown variant */
select.large {
  padding: 16px 48px 16px 20px;
  min-height: 52px;
  font-size: 1.1rem;
  background-size: 24px;
  background-position: right 16px center;
}

/* Success state for when selection is made */
select.success {
  border-color: #28a745;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2328a745' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
}

/* Error/warning state */
select.error {
  border-color: #dc3545;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc3545' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
}

@media (max-width: 768px) {
  .dashboard-three-col {
    flex-direction: column;
  }

  .dashboard-section {
    margin-bottom: 2em;
  }

  .riders-grid {
    grid-template-columns: 1fr; /* optional: stack riders on mobile */
  }

  .rider-card {
    max-width: 100%;
    aspect-ratio: 1 / 1;
  }
}

.pool-card {
  background: transparent;
  border: none;
  padding: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5em;
}

.pool-card button {
  background: var(--accent);
  color: var(--dark);
  border: none;
  padding: 0.4em 0.8em;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.pool-card button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.draft-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5em;
  background: none;
  border: none;
}

.draft-entry button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.4em 0.8em;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85em;
  transition: background 0.2s;
}

.draft-entry button:hover:not(:disabled) {
  background: #fff;
  color: var(--accent);
}

.draft-entry button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.stat-card {
  background-color: white;
  border-radius: 10px;
  padding: 1em;
  min-width: 130px; /* wider to fit dates */
  text-align: center;
  font-family: 'Orbitron', sans-serif;
  font-weight: bold;
  color: var(--dark);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.stat-value {
  font-size: 1.4em;
  margin-bottom: 0.3em;
  word-wrap: break-word;
  white-space: normal;
}

.stats-grid {
  display: flex;
  justify-content: center;
  gap: 1.5em;
  flex-wrap: wrap;
  margin-bottom: 2em;
}

.profile-card {
  background-color: rgba(0, 0, 0, 0.6);
  padding: 2em;
  border-radius: 10px;
  max-width: 500px;
  margin: 0 auto;
  color: white;
  font-family: 'Orbitron', sans-serif;
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
}

.profile-card p {
  margin-bottom: 1em;
  line-height: 1.5;
}

.profile-card input,
.profile-card textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
}

.avatar-section {
  text-align: center;
  margin-bottom: 1.5em;
}

.form-group {
  margin-bottom: 1em;
}

/* ── Feedback Modal Styles ── */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.75);
  z-index: 1000;
}

.modal-content {
  background-color: #2b2b2b;
  color: #fff;
  max-width: 480px;
  margin: 5% auto;
  padding: 1.5rem;
  border-radius: 8px;
  font-family: 'Orbitron', sans-serif;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

.modal-content h2 {
  margin-top: 0;
  font-size: 1.6rem;
  text-align: center;
}

.modal-content .close {
  position: absolute;
  top: 0.75rem; right: 0.75rem;
  font-size: 1.4rem;
  color: #fff;
  cursor: pointer;
}
.modal-content .close:hover {
  color: #fff;
}

.modal-content .form-row {
  margin-bottom: 1rem;
}
.modal-content label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: bold;
  font-size: 0.9rem;
}

.modal-content select,
.modal-content textarea {
  width: 100%;
  font-family: inherit;
  resize: vertical;
}

.modal-content select {
  /* Inherits the modern styling from the base select rules above */
}

.modal-content textarea {
  padding: 0.6rem;
  background-color: #3a3a3a;
  border: 1px solid #555;
  border-radius: 4px;
  color: #fff;
  font-size: 0.95rem;
  min-height: 120px;
}

.modal-content .btn-accent {
  display: block;
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
  background-color: #e05d00;
  border: none;
  border-radius: 4px;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.modal-content .btn-accent:hover {
  background-color: #c04d00;
}



/* make the modal a bit wider */
.modal-content {
  max-width: 600px;        /* was 480px */
  padding: 2rem;           /* extra padding */
}

/* user-info banner */
.modal-content .user-info {
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  color: #ddd;
}

/* labels & inputs bigger */
.modal-content label {
  font-size: 1rem;
}
.modal-content select,
.modal-content textarea {
  font-size: 1rem;
  padding: 0.75rem;   /* more tappable area */
}

/* form rows more space */
.modal-content .form-row {
  margin-bottom: 1.5rem;  /* was 1rem */
}

/* button larger */
.modal-content .btn-accent {
  padding: 1rem;
  font-size: 1.1rem;
}

#ownedLeaguesModal .modal-content,
#leagueModal .modal-content {
  color: #000;
}

.btn-discord {
  background-color: #5865F2; /* Discord blurple */
  color: white;
  padding: 8px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s ease;
}

.btn-discord:hover {
  background-color: #4752C4;
}

/* ==== Mobile App-style Bottom Nav with Icons + Fallback ==== */
@media (max-width: 768px) {
  /* Keep top bar intact for right-side items */
  .navbar {
    position: sticky;
    top: 0;
    z-index: 900;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5em 0.75em;
    backdrop-filter: saturate(120%) blur(6px);
    background: color-mix(in srgb, var(--primary) 92%, transparent);
  }

  /* Bottom tab bar - ESSENTIALS ONLY */
  .navbar .nav-left {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1000;
    display: flex !important;
    gap: 0;
    margin: 0;
    padding: 8px calc(8px + env(safe-area-inset-right))
             calc(8px + env(safe-area-inset-bottom))
             calc(8px + env(safe-area-inset-left));
    background: color-mix(in srgb, var(--primary) 95%, black 5%);
    border-top: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 -6px 14px rgba(0,0,0,0.35);
    justify-content: space-around;
  }

  /* Hide non-essential nav items on mobile bottom bar */
  .navbar .nav-left li.dropdown,
  .navbar .nav-left li#navAdmin {
    display: none !important;
  }

  .navbar .nav-left li {
    flex: 1 1 0;
    max-width: 100px;
    list-style: none;
  }

  .navbar .nav-left li a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px 10px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 0.7rem;
    letter-spacing: 0.2px;
    line-height: 1.1;
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    border: 1px solid transparent;
    transition: background .2s, color .2s, border-color .2s, transform .08s;
    white-space: nowrap;
    font-weight: 500;
  }

  .navbar .nav-left li a:active { 
    transform: scale(0.95); 
  }

  .navbar .nav-left li a:hover,
  .navbar .nav-left li a.active {
    background: rgba(184, 92, 56, 0.15);
    border-color: rgba(184, 92, 56, 0.3);
    color: #fff;
  }

  /* Mobile Navigation Menu in Hamburger */
  .mobile-full-nav {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 8px;
    position: relative;
    z-index: 1100; /* Above beta banner and create/join buttons */
  }

  .nav-toggle:checked ~ .nav-right .mobile-full-nav {
    display: flex;
  }

  .mobile-nav-section {
    padding: 8px 12px;
  }

  .mobile-nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    margin-bottom: 8px;
  }

  .mobile-nav-link {
    display: block;
    padding: 10px 12px;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.95rem;
    margin-bottom: 4px;
  }

  .mobile-nav-link:hover,
  .mobile-nav-link:active {
    background: rgba(184, 92, 56, 0.15);
    border-left: 3px solid var(--accent);
    padding-left: 15px;
  }

  /* Icon slot */
  .navbar .nav-left li a::before {
    content: "";
    width: 22px;
    height: 22px;
    display: inline-block;
    background-color: currentColor;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: 22px 22px;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: 22px 22px;
  }

  /* ===== Route-based icons ===== */
  .navbar .nav-left a[href*="dashboard"]::before {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M11 3v10H3V3h8m10 0v6h-8V3h8M11 21H3v-6h8v6m10 0h-8v-10h8v10z'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M11 3v10H3V3h8m10 0v6h-8V3h8M11 21H3v-6h8v6m10 0h-8v-10h8v10z'/></svg>");
  }
  .navbar .nav-left a[href*="draft"]::before {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25M20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25M20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/></svg>");
  }
  .navbar .nav-left a[href*="team"]::before {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V20h14v-1.5C15 14.17 10.33 13 8 13m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V20h6v-1.5c0-2.33-4.67-3.5-7-3.5z'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V20h14v-1.5C15 14.17 10.33 13 8 13m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V20h6v-1.5c0-2.33-4.67-3.5-7-3.5z'/></svg>");
  }
  .navbar .nav-left a[href*="leaderboard"]::before {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M7 17v-7h3v7H7m7 0V7h3v10h-3M3 21V3h2v18H3m16 0V3h2v18h-2M11 17v-4h3v4h-3z'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M7 17v-7h3v7H7m7 0V7h3v10h-3M3 21V3h2v18H3m16 0V3h2v18h-2M11 17v-4h3v4h-3z'/></svg>");
  }
  .navbar .nav-left a[href*="events"]::before {
    -webkit-mask-image: url("data:image/svg+xml;utf8;<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M19 4h-1V2h-2v2H8V2H6v2H5c-1.1 0-2 .9-2 2v13a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6c0-1.1-.9-2-2-2m0 15H5V10h14v9M5 8V6h14v2H5z'/></svg>");
    mask-image: url("data:image/svg+xml;utf8;<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M19 4h-1V2h-2v2H8V2H6v2H5c-1.1 0-2 .9-2 2v13a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6c0-1.1-.9-2-2-2m0 15H5V10h14v9M5 8V6h14v2H5z'/></svg>");
  }
  .navbar .nav-left a[href*="admin"]::before {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M12 8a4 4 0 1 1 0 8 4 4 0 0 1 0-8m8.94 3a7.99 7.99 0 0 0-.64-1.54l2.06-2.06-2.12-2.12-2.06 2.06c-.49-.27-1-.49-1.54-.64L16 2h-4l-.64 2.7c-.54.15-1.05.37-1.54.64L7.76 3.28 5.64 5.4l2.06 2.06c-.27.49-.49 1-.64 1.54L4 8v4l2.7.64c.15.54.37 1.05.64 1.54L5.28 16.24 7.4 18.36l2.06-2.06c.49.27 1 .49 1.54.64L12 20h4l.64-2.7c.54-.15 1.05-.37 1.54-.64l2.06 2.06 2.12-2.12-2.06-2.06c.27-.49.49-1 .64-1.54L22 12z'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M12 8a4 4 0 1 1 0 8 4 4 0 0 1 0-8m8.94 3a7.99 7.99 0 0 0-.64-1.54l2.06-2.06-2.12-2.12-2.06 2.06c-.49-.27-1-.49-1.54-.64L16 2h-4l-.64 2.7c-.54.15-1.05.37-1.54.64L7.76 3.28 5.64 5.4l2.06 2.06c-.27.49-.49 1-.64 1.54L4 8v4l2.7.64c.15.54.37 1.05.64 1.54L5.28 16.24 7.4 18.36l2.06-2.06c.49.27 1 .49 1.54.64L12 20h4l.64-2.7c.54-.15 1.05-.37 1.54-.64l2.06 2.06 2.12-2.12-2.06-2.06c.27-.49.49-1 .64-1.54L22 12z'/></svg>");
  }

  /* Ensure hidden admin stays hidden */
  #navAdmin[style*="display:none"] { display: none !important; }

  /* Make sure content isn't hidden under bar */
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

  /* Neutralize earlier mobile stacking for nav */
  .navbar ul { flex-direction: row; width: auto; gap: 0; }
}

/* ==== Fallback for missing viewport meta ==== */
@media screen and (max-device-width: 812px), screen and (max-width: 768px) {
  .navbar .nav-left {
    position: fixed !important;
    bottom: 0 !important;
    top: auto !important;
    left: 0; right: 0;
    z-index: 1000;
  }
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important; }
}

/* Hide bottom bar scrollbar */
.navbar .nav-left::-webkit-scrollbar { display: none; }
.navbar .nav-left { scrollbar-width: none; }

/* Force nav-left to bottom on mobile */
@media (max-width: 768px) {
  body .navbar .nav-left {
    position: fixed !important;
    bottom: 0 !important;
    top: auto !important;
    left: 0;
    right: 0;
    z-index: 1000 !important;
  }

  /* Make sure page content isn't hidden under the nav */
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important;
  }
}

/* --- Fix: ensure bottom tab bar is fixed to the viewport on mobile --- */
@media (max-width: 768px) {
  /* Remove anything that makes .nav-left "fixed-inside-navbar" on mobile */
  .navbar {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    transform: none !important;
    filter: none !important;
    perspective: none !important;
  }

  /* Now truly fix .nav-left to the viewport bottom */
  body .navbar .nav-left {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    z-index: 2147483647 !important; /* win all stacking contests */
  }

  /* Prevent content from sitting under the bar */
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom)) !important;
    min-height: 100dvh; /* modern mobile viewport unit */
  }
}

/* Hide mobile functionality checkboxes from visual display */
.nav-toggle,
.picks-toggle {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  clip: rect(0 0 0 0) !important;
  border: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* If some page still lacks the viewport meta, keep the fallback */
@media screen and (max-device-width: 812px) {
  body .navbar .nav-left {
    position: fixed !important;
    bottom: 0 !important;
  }
}

/* === Right-side hamburger dropdown (mobile) === */
@media (max-width: 768px) {
  /* Hide the raw checkbox */
  .nav-toggle {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    clip: rect(0 0 0 0);
    border: 0; overflow: hidden;
  }

  /* Hamburger button */
  .hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 10px;
    margin-left: auto;              /* push it to the right */
    cursor: pointer;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
  }
  .hamburger::before {
    content: "";
    width: 20px;
    height: 20px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z'/></svg>") no-repeat center / 20px 20px;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z'/></svg>") no-repeat center / 20px 20px;
  }

  /* Keep top bar slim */
  .navbar {
    align-items: center;
    gap: 10px;
    min-height: 56px; /* Ensure enough height for avatar and hamburger */
    padding-right: 112px; /* Make room for avatar (40px) + gap (8px) + hamburger (40px) + padding (8px) */
  }

  /* Collapse the right-side actions into a dropdown panel */
  .nav-right {
    position: fixed;
    top: calc(56px + env(safe-area-inset-top));  /* just below navbar */
    right: 10px;
    left: 10px;
    display: none;                     /* hidden by default */
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: color-mix(in srgb, var(--primary) 92%, #000 8%);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.45);
    z-index: 1200;
  }

  /* Open when toggled */
  .nav-toggle:checked ~ .nav-right { display: flex; }

  /* Dim the page when open (click hamburger to close) */
  .navbar:has(.nav-toggle:checked)::after {
    content: "";
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 1100;
  }

  /* Compact the buttons inside the dropdown */
  .nav-right .btn,
  .nav-right .btn-discord,
  .nav-right .btn-logout {
    width: 100%;
    justify-content: center;
    padding: 10px 12px;
    font-size: 0.95rem;
    border-radius: 10px;
    white-space: nowrap;
  }

  /* Keep the bottom tab bar (left nav) as before */
  .navbar .nav-left {
    position: fixed !important;
    left: 0; right: 0; bottom: 0;
    z-index: 1000;
  }

  /* Make sure content clears the bottom bar */
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
}

/* --- Make the hamburger always visible and clickable on mobile --- */
@media (max-width: 768px) {
  /* Nav container becomes the positioning context */
  .navbar {
    position: sticky; /* already used; also serves as positioned ancestor */
    top: 0;
  }

  /* Prevent the (fixed) bottom tabs ul from stealing flex space in the header */
  .navbar .nav-left {
    flex: 0 0 auto !important;
    width: auto !important;
  }

  /* Pin the hamburger top-right so flex can't squeeze it out */
  .hamburger {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    z-index: 1201; /* above the dropdown backdrop */
  }

  /* Position avatar next to hamburger button */
  .navbar .avatar-link {
    position: absolute;
    top: 8px;
    right: 56px; /* 8px (hamburger right) + 40px (hamburger width) + 8px (gap) */
    width: 40px;
    height: 40px;
    z-index: 1201;
    border: 2px solid var(--accent);
    border-radius: 50%;
    overflow: hidden;
  }

  .navbar .avatar-link img.avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .hamburger::before {
    content: "";
    width: 20px; height: 20px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z'/></svg>") no-repeat center / 20px 20px;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z'/></svg>") no-repeat center / 20px 20px;
  }

  /* Hide the checkbox but keep it working with the label */
  .nav-toggle {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    clip: rect(0 0 0 0);
    border: 0; overflow: hidden;
  }

  /* Dropdown panel (same as before, with a little animation) */
  .nav-right {
    position: fixed;
    top: calc(56px + env(safe-area-inset-top));
    right: 12px;
    left: 12px;
    bottom: calc(88px + env(safe-area-inset-bottom)); /* Leave room for bottom nav bar */
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: color-mix(in srgb, var(--primary) 92%, #000 8%);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.45);
    z-index: 1200;
    max-height: none; /* Let bottom property handle the constraint */
    overflow-y: auto;
    overflow-x: hidden;
  }
  .nav-toggle:checked ~ .nav-right {
    display: flex;
    animation: menuIn .18s ease-out;
  }
  @keyframes menuIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Backdrop when open (safe to keep; if Firefox acts up, we can polyfill) */
  .navbar:has(.nav-toggle:checked)::after {
    content: "";
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 1100;
  }
}

/* === Dashboard mobile upgrades (CSS-only) === */
@media (max-width: 768px) {
  /* 0) Performance: avoid fixed backgrounds on mobile */
  body { background-attachment: scroll !important; }

  /* 1) Slim hero */
  .hero {
    padding: 14px 12px;
    text-align: center;
  }
  .hero h1 { font-size: 1.6rem; line-height: 1.2; }
  .hero .date-tag { margin-top: 6px; }

  /* 2) Make the Create/Join toolbar a sticky action bar under the navbar */
  #navbar-placeholder + div {
    position: relative; /* Changed from sticky to relative */
    z-index: 10; /* Lower z-index so it doesn't overlap content */
    background: color-mix(in srgb, var(--primary) 92%, black 8%);
    padding: 10px !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 12px;
  }
  #navbar-placeholder + div .btn { width: 100% !important; }

  /* 3) Inputs card: first child inside #dashboardContent */
  #dashboardContent > div:first-child {
    margin: 10px;
    padding: 12px !important;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "labelA select"
      "refresh refresh"
      "labelB team"
      "save save";
    gap: 10px;
    align-items: center;
  }
  /* Map existing elements into the grid without HTML changes */
  #dashboardContent > div:first-child label[for="leagueSelect"] { grid-area: labelA; }
  #dashboardContent > div:first-child #leagueSelect { grid-area: select; min-height: 40px; }
  #dashboardContent > div:first-child #refreshBtn { grid-area: refresh; width: 100%; }
  #dashboardContent > div:first-child label[for="teamName"] { grid-area: labelB; }
  #dashboardContent > div:first-child #teamName {
    grid-area: team; min-height: 40px;
    width: 100%; border-radius: 8px;
    background: rgba(255,255,255,0.08); color: #fff;
  }
  #dashboardContent > div:first-child #saveTeamName { grid-area: save; width: 100%; }

  /* 4) Sections as cards */
  .dashboard-section {
    margin: 10px;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 12px;
  }
  .dashboard-section h2 {
    margin-bottom: 8px;
    font-size: 1.2rem;
    text-align: left;
  }

  /* 5) Stats readability */
  .stats-panel {
    background: rgba(0,0,0,0.35);
    border-radius: 10px;
    padding: 12px;
    line-height: 1.6;
    font-size: 0.95rem;
  }

  /* 6) Riders: two columns; fall back to horizontal scroll on tiny phones */
  .riders-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }
  @media (max-width: 380px) {
    .riders-grid {
      display: grid;
      grid-auto-flow: column;
      grid-auto-columns: 70%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scroll-snap-type: x mandatory;
    }
    .rider-card { scroll-snap-align: start; }
  }
  .rider-card { max-width: 100%; border-radius: 10px; }
  .rider-card .name { font-size: 0.9rem; }

  /* 7) Events as tiles */
  .events-stack > div {
    background: rgba(0,0,0,0.35) !important;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 12px;
  }
  .events-stack > div h3 { font-size: 1rem; margin-bottom: 4px; }

  /* 8) Buttons: full width inside cards */
  .dashboard-section .btn { width: 100%; margin-top: 8px; }

  /* 9) Keep content above the bottom tab bar */
  body { padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important; }
}

@media (max-width: 768px) {
  /* Force dashboard content to clear space for bottom nav */
  #dashboardContent {
    padding-bottom: calc(100px + env(safe-area-inset-bottom)) !important;
  }

  /* Make sure any scrolling containers also have space */
  #dashboardContent > * {
    margin-bottom: 80px; /* prevents last item from being hidden */
  }
}

/* ===== Draft page: mobile app layout ===== */
@media (max-width: 768px) {
  /* 0) Smooth scrolling, no janky fixed bgs */
  body { background-attachment: scroll !important; }

  /* 1) Keep key info visible */
  #navbar-placeholder + div { /* the H1 + league select row */
    position: relative; /* Changed from sticky */
    z-index: 10; /* Lowered z-index */
    background: color-mix(in srgb, var(--primary) 92%, #000 8%);
    padding: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
  }
  #draftBanner,
  #currentTurn {
    position: sticky;
    top: calc(56px + 44px + env(safe-area-inset-top)); /* under the row above */
    z-index: 890;
    background: color-mix(in srgb, var(--primary) 90%, #000 10%);
    padding: 8px 12px;
    margin: 0 !important;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  #draftBanner .timer { font-size: 1rem; }

  /* 2) Stack layout: pool first, "sidebar" next */
  .draft-container {
    display: block !important;
    padding: 10px !important;
  }

  /* 3) Rider pool grid = 2 columns, comfy cards */
  .rider-pool-grid,
  #riderPool {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin: 10px 0 !important;
  }
  @media (max-width: 380px) {
    .rider-pool-grid,
    #riderPool {
      grid-template-columns: 1fr !important;
    }
  }

  .draft-entry {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 10px;
  }
  .draft-entry .rider-card {
    max-width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0,0,0,0.35);
  }
  .draft-entry .rider-card img {
    width: 100%; height: auto; display: block;
    aspect-ratio: 1/1; object-fit: cover;
  }
  .draft-entry .rider-card .name {
    font-size: 0.95rem;
    padding: 6px 8px;
    background: rgba(0,0,0,0.5);
  }
  .draft-entry button {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 700;
  }

  /* 4) Transform the sidebar into a compact, sticky “picks bar” */
  .player-sidebar {
    position: sticky;
    top: calc(56px + 44px + 42px + env(safe-area-inset-top)); /* below banner/turn */
    z-index: 880;
    background: color-mix(in srgb, var(--primary) 90%, #000 10%);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 8px 10px;
    margin: 12px 0;
    max-height: 28vh;
    overflow: auto;
  }
  .player-sidebar h2 {
    font-size: 1rem;
    margin: 0 0 6px 0;
    text-align: left;
  }
  /* Player blocks as chips list */
  .player-section {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 8px;
  }
  .player-section + .player-section { margin-top: 8px; }
  .player-section h3 {
    font-size: 0.95rem;
    margin: 0 0 6px 0;
  }
  .player-section ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-left: 0 !important;
  }
  .player-section li {
    list-style: none;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.85rem;
  }

  /* 5) Buttons/inputs at top row: full-width */
  select#leagueSelect {
    width: 100%;
    min-height: 40px;
    /* Inherits the modern styling from the base select rules above */
  }

  /* 6) Keep content above the bottom nav */
  body { padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important; }
  #draftBanner, #currentTurn, .player-sidebar, .draft-container { scroll-margin-top: 80px; }
}

/* ===== Mobile slide-out picks panel (Draft) ===== */
@media (max-width: 768px) {
  /* Hide the raw checkbox accessibly */
  .picks-toggle {
    position: fixed;
    top: -100px; /* way off-screen */
    left: -100px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
  }

  /* Floating arrow tab (mid-right) */
  .picks-tab {
    position: fixed;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1500;
    width: 42px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-tap-highlight-color: transparent;
  }
  .picks-tab::before {
    content: "";
    width: 20px; height: 20px;
    background: #fff;
    /* chevron icon pointing left */
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z'/></svg>") no-repeat center / 20px 20px;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z'/></svg>") no-repeat center / 20px 20px;
    opacity: 0.9;
  }

  /* Slide-out panel (reusing your .player-sidebar content) */
  .player-sidebar {
    position: fixed !important;
    top: calc(10px + env(safe-area-inset-top));
    right: 0;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: min(86vw, 380px);
    max-width: 90vw;
    z-index: 1499;
    overflow: auto;
    background: color-mix(in srgb, var(--primary) 92%, #000 8%);
    border-left: 1px solid rgba(255,255,255,0.12);
    border-top-left-radius: 14px;
    border-bottom-left-radius: 14px;
    padding: 12px 12px 16px 12px;
    transform: translateX(105%);         /* hidden offscreen */
    transition: transform .22s ease-out;
    box-shadow: -16px 0 36px rgba(0,0,0,0.45);
  }

  /* When toggled ON: show panel, flip tab chevron, add backdrop */
  .picks-toggle:checked ~ .player-sidebar {
    transform: translateX(0);
  }
  .picks-toggle:checked ~ .picks-tab {
    right: calc(min(86vw, 380px) + 8px); /* move tab out with the panel */
  }
  .picks-toggle:checked ~ .picks-tab::before {
    /* chevron points right to indicate close */
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z'/></svg>") no-repeat center / 20px 20px;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z'/></svg>") no-repeat center / 20px 20px;
  }

  /* Backdrop */
  .picks-toggle:checked ~ .player-sidebar::after {
    content: "";
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: -1; /* sits behind the panel, above page */
  }

  /* Nice chips inside still apply from earlier rules; tighten small text */
  .player-sidebar h2 { font-size: 1rem; margin: 0 0 8px; }
  .player-section { background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 8px; }
  .player-section + .player-section { margin-top: 8px; }
  .player-section h3 { font-size: 0.95rem; margin: 0 0 6px; }
  .player-section ul { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 0 !important; }
  .player-section li { list-style: none; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); padding: 4px 8px; border-radius: 999px; font-size: 0.85rem; }

  /* Make sure draft content never hides under bottom nav */
  body { padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important; }
}

/* ===== My Team — Mobile app polish ===== */
@media (max-width: 768px) {
  /* 0) Performance + spacing */
  body { background-attachment: scroll !important; }
  #teamsContainer { padding: 10px 10px calc(100px + env(safe-area-inset-bottom)) !important; }

  /* 1) Slim hero */
  .hero { padding: 14px 12px; }
  .hero h1 { font-size: 1.6rem; line-height: 1.2; }

  /* 2) League header stays visible while scrolling team */
  .team-section h3 {
    position: sticky;
    top: calc(56px + env(safe-area-inset-top)); /* below the top navbar */
    z-index: 2;
    margin: 0 0 10px 0;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--primary) 92%, #000 8%);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 1.05rem;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
  }

  /* 3) Team grid = app-like cards */
  .team-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    padding: 10px 0 0 0;
  }
  @media (max-width: 380px) {
    .team-grid { grid-template-columns: 1fr !important; }
  }

  .team-card {
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: transform .08s ease, box-shadow .2s ease;
  }
  .team-card:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  }

  /* Square rider images with smooth reveal */
  .team-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: rgba(255,255,255,0.05);
    opacity: 0;
    transition: opacity .3s ease;
  }
  .team-card img[src] { opacity: 1; } /* fade in when src set */

  .team-card .name {
    padding: 8px 10px 2px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    text-align: center;
  }
  .team-card .points {
    padding: 0 10px 10px;
    font-size: 0.9rem;
    color: #ffdca8; /* subtle highlight */
    text-align: center;
  }

  /* 4) Empty state */
  .empty-msg,
  .empty-team {
    margin: 14px 10px;
    padding: 14px 12px;
    text-align: center;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    color: #fff;
  }

  /* 5) Smooth anchor focus below sticky header */
  .team-section, .team-grid, .team-card { scroll-margin-top: 80px; }
}

/* ===== Leaderboard: card layout on mobile (no horizontal scroll) ===== */
@media (max-width: 768px) {
  /* Section container + header */
  .leaderboard-section {
    margin: 12px 10px;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 10px;
  }
  .leaderboard-section h3 {
    position: static;               /* simpler, avoids weird stacking */
    margin: 0 0 10px 0;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--primary) 92%, #000 8%);
    border-radius: 10px;
    font-size: 1.05rem;
  }

  /* Kill sideways scrolling & transform rows into cards */
  .leaderboard-section table {
    display: block;
    width: 100%;
    overflow: visible;              /* no horizontal scroll */
    border-collapse: collapse;
  }
  .leaderboard-section thead { display: none; } /* hide header row */

  .leaderboard-section tbody { display: block; }
  .leaderboard-section tbody tr {
    display: block;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 8px;
    margin: 0 0 10px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  }

  /* Each cell becomes a 2-column row: label | value */
  .leaderboard-section tbody td {
    display: grid;
    grid-template-columns: 120px 1fr;
    align-items: center;
    gap: 8px;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 0.95rem;
    white-space: normal;
  }
  .leaderboard-section tbody td:last-child { border-bottom: 0; }

  /* Labels injected per column index — adjust text to match your columns */
  .leaderboard-section tbody td:nth-child(1)::before { content: "Pick Order"; color: #ccc; }
  .leaderboard-section tbody td:nth-child(2)::before { content: "Team Name";  color: #ccc; }
  .leaderboard-section tbody td:nth-child(3)::before { content: "Manager";    color: #ccc; }
  .leaderboard-section tbody td:nth-child(4)::before { content: "Points";     color: #ccc; }
  .leaderboard-section tbody td:nth-child(5)::before { content: "Wins";       color: #ccc; }
  .leaderboard-section tbody td:nth-child(6)::before { content: "Action";     color: #ccc; }

  /* Make action buttons full-width inside cards (if present) */
  .leaderboard-section .view-team-btn.btn {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 700;
  }

  /* Keep content well above the bottom tab bar */
  #leaderboardContainer { padding-bottom: calc(100px + env(safe-area-inset-bottom)) !important; }
  .leaderboard-section, .leaderboard-section tbody tr { scroll-margin-top: 80px; }
}

/* ===== Fix mobile modal: full-height, scroll inside, sticky header/footer ===== */
@media (max-width: 768px) {
  /* Make sure modals sit above everything else */
  .modal,
  #teamModal.modal { 
    z-index: 4000 !important; 
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0,0,0,0.8) !important;
  }

  /* Add safe padding so nothing is hidden by top/bottom chrome */
  .modal.show,
  #teamModal.modal.show,
  .modal[style*="flex"],
  #teamModal.modal[style*="flex"] {
    display: flex;                 /* center using flex */
    align-items: center;
    justify-content: center;
    padding: calc(env(safe-area-inset-top) + 8px) 0
             calc(env(safe-area-inset-bottom) + 8px);
  }

  /* The box fits the viewport and scrolls internally */
  .modal .modal-content,
  #teamModal .modal-content {
    width: 92%;
    max-width: 560px;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
    margin: 0 auto;
    overflow: auto;                 /* <-- scroll inside the modal */
    overscroll-behavior: contain;   /* prevent page scroll peeking through */
    border-radius: 12px;
  }

  /* Keep the modal header/footer visible */
  .modal .modal-header,
  #teamModal .modal-header {
    position: sticky;
    top: 0;
    background: inherit;            /* same bg as content */
    z-index: 1;
  }
  .modal .modal-footer,
  #teamModal .modal-footer {
    position: sticky;
    bottom: 0;
    background: inherit;
    z-index: 1;
  }

  /* Make the close button easy to hit */
  .modal-close,
  .modal .close {
    width: 44px;
    height: 44px;
    line-height: 44px;
    font-size: 1.5rem;
    border-radius: 8px;
    touch-action: manipulation;
  }

  /* Make view team buttons more touch-friendly on mobile */
  .view-team-btn,
  .mobile-view-team {
    min-height: 44px !important;
    padding: 12px 20px !important;
    font-size: 1rem !important;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(224, 93, 0, 0.3);
  }

  /* Ensure mobile team cards have proper spacing for touch */
  .mobile-team-card {
    touch-action: manipulation;
    margin-bottom: 16px;
  }
}

/* ===== HOW IT WORKS PAGE STYLING ===== */
.how-it-works-section {
  background: var(--light);
  margin: 2em 0;
  padding: 0;
  border-radius: 12px;
  border-left: 4px solid var(--accent);
  overflow: hidden;
}

.collapsible-header {
  background: linear-gradient(135deg, rgba(224, 93, 0, 0.1), rgba(224, 93, 0, 0.05));
  color: var(--accent);
  margin: 0;
  padding: 1.5em 2em;
  font-size: 1.8rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5em;
  border-bottom: 1px solid rgba(224, 93, 0, 0.2);
}

.collapsible-header:hover {
  background: linear-gradient(135deg, rgba(224, 93, 0, 0.2), rgba(224, 93, 0, 0.1));
  transform: translateX(5px);
}

.collapsible-header.expanded {
  background: linear-gradient(135deg, rgba(224, 93, 0, 0.15), rgba(224, 93, 0, 0.08));
}

.toggle-icon {
  font-size: 1rem;
  transition: transform 0.3s ease;
  color: var(--accent);
  font-weight: bold;
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out;
  padding: 0 2em;
}

.collapsible-content > *:first-child {
  margin-top: 2em;
}

.collapsible-content > *:last-child {
  margin-bottom: 2em;
}

.how-it-works-section h2 {
  color: var(--accent);
  margin-top: 0;
  margin-bottom: 1.5em;
  font-size: 1.8rem;
}

.quick-start-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5em;
  margin-top: 1.5em;
}

.quick-step {
  text-align: center;
  padding: 1.5em;
  background: rgba(224, 93, 0, 0.1);
  border-radius: 8px;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.quick-step:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.step-number {
  display: inline-block;
  width: 50px;
  height: 50px;
  background: var(--accent);
  color: var(--dark);
  border-radius: 50%;
  line-height: 50px;
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 1em;
}

.quick-step h3 {
  color: var(--accent);
  margin-bottom: 0.5em;
}

.feature-explanation {
  margin: 2em 0;
  padding: 1.5em;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.explanation-content {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2em;
  align-items: start;
}

.explanation-text ul {
  margin: 1em 0;
  padding-left: 1.5em;
}

.explanation-text li {
  margin-bottom: 0.5em;
  line-height: 1.6;
}

.highlight {
  color: var(--accent);
  font-weight: bold;
}

.free-badge, .premium-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: bold;
  margin-right: 0.5em;
}

.free-badge {
  background: #6c757d;
  color: white;
}

.premium-badge {
  background: var(--accent);
  color: var(--dark);
}

.explanation-visual {
  background: var(--dark);
  border-radius: 8px;
  padding: 1em;
  border: 1px solid #333;
}

.mock-interface, .mock-draft, .mock-prepick, .mock-team, .mock-events, .mock-leaderboard {
  color: #fff;
}

.mock-interface h4, .mock-draft .draft-header, .mock-prepick h4, .mock-team h4, .mock-events h4, .mock-leaderboard h4 {
  margin: 0 0 1em 0;
  color: var(--accent);
  font-size: 1.1rem;
}

.mock-form {
  display: flex;
  flex-direction: column;
  gap: 0.8em;
}

.mock-field {
  display: flex;
  justify-content: space-between;
  padding: 0.5em;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.mock-btn {
  background: var(--accent);
  color: var(--dark);
  border: none;
  padding: 0.8em;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

.draft-timer {
  font-size: 1.2em;
  color: var(--accent);
  text-align: center;
  margin-bottom: 1em;
}

.draft-order {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.draft-slot {
  padding: 0.5em;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}

.draft-slot.completed {
  background: rgba(40, 167, 69, 0.3);
}

.draft-slot.active {
  background: var(--accent);
  color: var(--dark);
  font-weight: bold;
}

.prepick-item {
  padding: 0.4em 0;
  border-bottom: 1px solid #333;
}

.prepick-more {
  color: #999;
  font-style: italic;
  margin-top: 0.5em;
}

.team-rider {
  display: flex;
  align-items: center;
  gap: 0.8em;
  margin-bottom: 0.8em;
}

.rider-info {
  flex: 1;
}

.rider-name {
  font-weight: bold;
}

.rider-points {
  color: var(--accent);
  font-size: 0.9em;
}

.team-more {
  color: #999;
  font-style: italic;
}

.event-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5em 0;
  border-bottom: 1px solid #333;
}

.event-date {
  color: var(--accent);
  font-weight: bold;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 1em;
  padding: 0.5em;
  border-bottom: 1px solid #333;
}

.leaderboard-row.header {
  font-weight: bold;
  color: var(--accent);
}

.leaderboard-row.highlight {
  background: rgba(224, 93, 0, 0.2);
  border-radius: 4px;
}

.scoring-breakdown {
  margin: 2em 0;
}

.scoring-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5em;
  margin: 2em 0;
}

.scoring-category {
  background: rgba(224, 93, 0, 0.1);
  padding: 1.5em;
  border-radius: 8px;
  text-align: center;
}

.scoring-category h4 {
  color: var(--accent);
  margin-bottom: 0.5em;
}

.scoring-example {
  margin-top: 1em;
  padding: 0.8em;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  font-weight: bold;
}

.scoring-example-full {
  background: var(--dark);
  padding: 1.5em;
  border-radius: 8px;
  margin-top: 2em;
}

.scoring-example-full h4 {
  color: var(--accent);
  margin-bottom: 1em;
}

.calculation {
  color: #fff;
}

.calc-line {
  margin-bottom: 1em;
  font-style: italic;
}

.calc-breakdown {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
  font-family: monospace;
  font-size: 1.1em;
}

.calc-breakdown span {
  background: rgba(224, 93, 0, 0.2);
  padding: 0.3em 0.6em;
  border-radius: 4px;
}

.tier-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2em;
  margin: 2em 0;
}

.tier-column {
  padding: 1.5em;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.tier-column.premium {
  background: linear-gradient(135deg, rgba(224, 93, 0, 0.1), rgba(255, 215, 0, 0.1));
  border: 2px solid var(--accent);
}

.tier-title {
  text-align: center;
  margin-bottom: 1.5em;
  padding: 0.8em;
  border-radius: 4px;
}

.tier-title.free {
  background: #6c757d;
  color: white;
}

.tier-title.premium {
  background: var(--accent);
  color: var(--dark);
}

.tier-features {
  display: flex;
  flex-direction: column;
  gap: 0.8em;
}

.feature-item {
  padding: 0.6em;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
}

.feature-item.highlight {
  background: rgba(224, 93, 0, 0.2);
  border-left: 3px solid var(--accent);
}

.upgrade-note {
  margin-top: 1.5em;
  padding: 1em;
  background: rgba(255, 193, 7, 0.1);
  border-radius: 4px;
  border-left: 3px solid #ffc107;
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5em;
  margin: 2em 0;
}

.tip-card {
  background: rgba(224, 93, 0, 0.1);
  padding: 1.5em;
  border-radius: 8px;
  border-left: 4px solid var(--accent);
}

.tip-card h4 {
  color: var(--accent);
  margin-bottom: 1em;
}

.tip-card ul {
  margin: 0;
  padding-left: 1.5em;
}

.tip-card li {
  margin-bottom: 0.6em;
  line-height: 1.5;
}

.cta-section {
  text-align: center;
  background: linear-gradient(135deg, var(--dark), #2a2a2a);
  border: 2px solid var(--accent);
}

.cta-buttons {
  display: flex;
  justify-content: center;
  gap: 1em;
  margin: 2em 0;
  flex-wrap: wrap;
}

.btn.large {
  padding: 1em 2em;
  font-size: 1.1em;
}

.cta-note {
  color: #999;
  font-style: italic;
  margin-top: 1em;
}

/* Mobile responsiveness for How It Works */
@media (max-width: 768px) {
  .explanation-content {
    grid-template-columns: 1fr;
    gap: 1em;
  }
  
  .tier-comparison {
    grid-template-columns: 1fr;
  }
  
  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .calc-breakdown {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== Profile (mobile) — keep original look, just reflow ===== */
@media (max-width: 768px) {
  /* page padding + prevent accidental horizontal scroll */
  .profile-page {
    padding: 10px 12px calc(90px + env(safe-area-inset-bottom));
    overflow-x: hidden;
  }

  /* title scale */
  .profile-page h1 {
    font-size: 1.6rem;
    line-height: 1.2;
    margin: 8px 0 12px;
    text-align: left;
  }

  /* --- Stats: 2x2 grid --- */
  .profile-page .stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin: 10px 0 14px !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .profile-page .stat-card {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  /* --- Avatar row: image left, button wraps below (no overlap) --- */
  .avatar-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;              /* allows button to drop below on narrow phones */
    margin-bottom: 12px;
  }
  .avatar-section img {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
  }
  .avatar-section .btn {
    flex: 1 1 100%;               /* full width under the avatar */
    display: block;
    width: 100%;
    margin-top: 4px;
  }

  /* card spacing */
  .profile-card {
    padding: 14px;
    border-radius: 12px;
  }

  /* form + buttons comfy tap targets */
  .form-group input,
  .form-group textarea { min-height: 44px; border-radius: 10px; }
  .button-group { gap: 10px; }
  .button-group .btn { flex: 1 1 50%; padding: 10px 12px; border-radius: 10px; }
}

/* === Enhanced Events Page Styles === */
.events-enhanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5em;
  margin-top: 1em;
}

.event-card {
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 1.2em;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  color: #fff;
}

.event-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

.event-card.today {
  border-color: #ff4444;
  box-shadow: 0 0 15px rgba(255, 68, 68, 0.3);
}

.event-card.completed {
  border-color: #44ff44;
}

.event-card.upcoming {
  border-color: var(--accent);
}

.event-status {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 1em;
  padding: 0.3em 0.6em;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.event-status.today {
  background: rgba(255, 68, 68, 0.2);
  color: #ff6666;
}

.event-status.completed {
  background: rgba(68, 255, 68, 0.2);
  color: #66ff66;
}

.event-status.upcoming {
  background: rgba(184, 92, 56, 0.2);
  color: var(--accent);
}

.event-content {
  margin-bottom: 1em;
}

.event-title {
  color: #fff;
  font-size: 1.3em;
  margin-bottom: 0.5em;
  line-height: 1.2;
  font-weight: bold;
}

.event-date {
  display: flex;
  align-items: center;
  gap: 0.4em;
  color: #ccc;
  font-size: 0.95em;
  margin-bottom: 0.3em;
  font-weight: 500;
}

.event-series {
  color: var(--accent);
  font-size: 0.85em;
  font-weight: bold;
  margin-bottom: 0.3em;
}

.event-location {
  display: flex;
  align-items: center;
  gap: 0.4em;
  color: #aaa;
  font-size: 0.85em;
}

.event-actions {
  display: flex;
  justify-content: flex-end;
}

.btn-sm {
  padding: 0.4em 0.8em;
  font-size: 0.85em;
  border-radius: 6px;
}

/* Filter buttons styling */
.event-filters {
  display: flex;
  gap: 0.5em;
  flex-wrap: wrap;
}

.btn-secondary {
  background: #666;
  color: #fff;
  opacity: 0.7;
}

.btn-secondary:hover {
  opacity: 1;
  transform: scale(1.05);
}

.active-filter {
  opacity: 1;
  box-shadow: 0 2px 8px rgba(184, 92, 56, 0.4);
}

/* Loading spinner */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1em;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Mobile responsive for events page */
@media (max-width: 768px) {
  .events-enhanced-grid {
    grid-template-columns: 1fr;
    gap: 1em;
  }
  
  .event-filters {
    justify-content: center;
  }
  
  .event-filters .btn {
    flex: 1;
    min-width: 80px;
  }
  
  .event-card {
    padding: 1em;
  }
  
  .event-title {
    font-size: 1.1em;
  }
}

/* === Toggle Switch === */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--accent);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.switch-label {
  color: #fff;
  font-size: 0.9em;
  user-select: none;
}

/* === Home Page Footer === */
.home-footer {
  background: rgba(28, 39, 51, 0.95);
  color: #fff;
  padding: 2em 1em;
  margin-top: 3em;
  border-top: 2px solid var(--accent);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2em;
  margin-bottom: 1.5em;
  flex-wrap: wrap;
}

.footer-link {
  color: #fff;
  text-decoration: none;
  padding: 0.5em 1em;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.footer-link:hover {
  color: var(--accent);
  background: rgba(184, 92, 56, 0.1);
}

.footer-copyright {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 1.5em;
}

.footer-copyright p {
  margin: 0.5em 0;
  color: #ccc;
}

.footer-disclaimer {
  font-size: 0.9em;
  font-style: italic;
  color: #aaa;
}

@media (max-width: 768px) {
  .footer-links {
    flex-direction: column;
    gap: 1em;
  }
  
  .footer-link {
    display: block;
    margin: 0 auto;
    max-width: 200px;
  }
}

/* === Site Footer (Internal Pages) === */
.site-footer {
  background: rgba(28, 39, 51, 0.95);
  color: #fff;
  padding: 1.5em 1em;
  margin-top: 2em;
  border-top: 1px solid rgba(184, 92, 56, 0.3);
}

.site-footer .footer-content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.site-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5em;
  margin-bottom: 1em;
  flex-wrap: wrap;
}

.site-footer .footer-link {
  color: #ccc;
  text-decoration: none;
  padding: 0.3em 0.8em;
  border-radius: 4px;
  font-size: 0.9em;
  transition: all 0.3s ease;
}

.site-footer .footer-link:hover {
  color: var(--accent);
  background: rgba(184, 92, 56, 0.1);
}

.site-footer .footer-copyright {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1em;
}

.site-footer .footer-copyright p {
  margin: 0.3em 0;
  color: #aaa;
  font-size: 0.9em;
}

.site-footer .footer-disclaimer {
  font-size: 0.8em;
  font-style: italic;
  color: #888;
}

@media (max-width: 768px) {
  .site-footer .footer-links {
    flex-direction: column;
    gap: 0.8em;
  }
  
  .site-footer .footer-link {
    display: block;
  }
}

/* === Referral Section Styles === */
.referral-section {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  padding: 2.5em;
  margin: 2em 0;
  box-shadow: none;
  border: none;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  color: #fff;
  line-height: 1.8;
}

.referral-section:hover {
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.referral-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent) 0%, #ffd700 100%);
}

.referral-section h2 {
  color: #fff;
  margin-bottom: 2em;
  text-align: center;
  font-size: 2.2em;
  font-weight: 700;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.referral-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
  border-radius: 16px;
  padding: 2em;
  margin-bottom: 2em;
  border: 2px solid var(--accent);
  box-shadow: 0 6px 20px rgba(244, 185, 66, 0.2);
  transition: transform 0.3s ease;
}

.referral-card:hover {
  transform: translateY(-3px);
}

.referral-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5em;
  flex-wrap: wrap;
  gap: 1em;
}

.referral-header h3 {
  color: var(--primary);
  font-size: 1.4em;
  font-weight: 700;
  margin: 0;
}

.referral-code-display {
  display: flex;
  align-items: center;
  gap: 1em;
  flex-wrap: wrap;
}

.referral-code-display span {
  font-family: 'Courier New', monospace;
  font-size: 1.3em;
  font-weight: bold;
  color: var(--primary);
  background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
  padding: 0.8em 1.2em;
  border-radius: 12px;
  border: 2px solid var(--accent);
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.referral-code-display span:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.referral-description {
  color: #666;
  font-size: 1.05em;
  margin: 0;
  font-weight: 500;
  line-height: 1.6;
}

.btn-small {
  font-size: 0.85em;
  padding: 0.6em 1.2em;
  border-radius: 20px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.referral-description {
  color: #666;
  margin: 0;
  font-style: italic;
}

.referral-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5em;
  margin-bottom: 2.5em;
}

.referral-stats-grid .stat-card {
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 1.2em 1.5em;
  border-radius: 8px;
  border: none;
  box-shadow: none;
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
  color: #fff;
  line-height: 1.8;
}

.referral-stats-grid .stat-card:hover {
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 20px 20px 0 0;
}

.stat-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
  background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 100%);
}

.stat-number {
  font-size: 2.2em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.3em;
  display: block;
}

.stat-label {
  color: #64748b;
  font-size: 0.95em;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.referrals-list h4 {
  color: #fff;
  margin-bottom: 1.5em;
  font-size: 1.3em;
  font-weight: 600;
}

.referral-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2em 1.5em;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  margin-bottom: 1em;
  border: none;
  box-shadow: none;
  transition: all 0.3s ease;
  color: #fff;
  line-height: 1.8;
}

.referral-item:hover {
  transform: translateX(8px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  background: rgba(0, 0, 0, 0.6);
}

.referral-info {
  flex: 1;
}

.referral-name {
  font-weight: 600;
  color: #fff;
  font-size: 1.05em;
  margin-bottom: 0.2em;
}

.referral-date {
  font-size: 0.85em;
  color: #ccc;
  font-weight: 500;
}

.referral-status {
  padding: 0.4em 1em;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
}

.status-converted {
  background: #d4edda;
  color: #155724;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
}

/* Profile Form Styling */
.profile-page .form-group {
  margin-bottom: 1.5em;
}

.profile-page .form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.8em;
  color: var(--dark);
  font-size: 1rem;
  letter-spacing: 0.3px;
}

.profile-page .form-group input,
.profile-page .form-group textarea {
  width: 100%;
  padding: 1em 1.2em;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  background: transparent;
  transition: all 0.3s ease;
  outline: none;
}

.profile-page .form-group input:focus,
.profile-page .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
  background: rgba(0,0,0,0.05);
}

.profile-page .form-group input:hover,
.profile-page .form-group textarea:hover {
  background: rgba(0,0,0,0.05);
}

.profile-page .button-group {
  display: flex;
  justify-content: flex-end;
  gap: 1.2em;
  margin-top: 2em;
}

.profile-page .btn {
  padding: 0.8em 2em;
  border-radius: 25px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.profile-page .btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.profile-page .btn:hover::before {
  left: 100%;
}

.profile-page #changeAvatarBtn {
  background: linear-gradient(135deg, #64748b, #475569);
  color: white;
  margin-top: 0.8em;
}

.profile-page #changeAvatarBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(100, 116, 139, 0.3);
}

.profile-page #editProfileBtn,
.profile-page #saveBtn {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
}

.profile-page #editProfileBtn:hover,
.profile-page #saveBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(var(--primary-rgb), 0.3);
}

.profile-page .checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.8em;
  padding: 1em;
  background: transparent;
  border-radius: 8px;
  border: 2px solid #e2e8f0;
  transition: all 0.3s ease;
}

.profile-page .checkbox-wrapper:hover {
  border-color: var(--primary);
  background: rgba(0,0,0,0.05);
}

.profile-page .checkbox-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* Responsive adjustments for referral section */
@media (max-width: 768px) {
  .referral-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1em;
  }
  
  .referral-stats-grid {
    grid-template-columns: 1fr;
  }

  .profile-page .button-group {
    flex-direction: column;
    gap: 1em;
  }

  .profile-page .btn {
    width: 100%;
    text-align: center;
  }
}
