* {
  box-sizing: border-box;
}

/* === GENERAL RESET & BASE === */
body {
  font-family: 'Roboto', sans-serif;
  margin: 0;
  padding: 0;
  background: #f9f9f9;
  color: #333;
}

h1, h3, p, label {
  margin: 0;
  padding: 0.4rem 0;
}

/* === HEADER WITH GRADIENT === */
header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  background: linear-gradient(
    145deg,
    #ff6a00 0%,
    #ff6300 25%,
    #e24f00 50%,
    #ff6300 75%,
    #ff6a00 100%
  );
  color: white;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 100;
  border-bottom: 2px solid #c84300;
  overflow: hidden;
}

header::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.25), transparent);
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: screen;
  z-index: 1;
}

#logo {
  max-height: 70px;
  width: auto;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6))
          drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

h1 {
  font-size: 1rem;
  font-weight: bold;
}

/* === STICKY RACE BANNER === */
.sticky-race-header {
  position: sticky;
  top: 35px;
  background-color: white;
/*  padding: 0.5rem 1rem; */
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  z-index: 1000;
}

.sticky-race-header p {
  margin: 0.0rem 0;
  font-weight: bold;
}

/* === SECTION CONTAINER === */
#home-section {
  padding: 1rem;
  max-width: 400px;
  margin: auto;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

select, label {
  width: 100%;
  display: block;
  font-size: 1rem;
}

select {
  padding: 0.6rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  margin-bottom: 1rem;
  background-color: #fff;
}

/* === PRACTICE SECTION === */
#practice-section {
  width: 100%
}

.race-card {
  padding: 0;
  background-color: white;
  box-shadow: none;
  align-items: center;
  text-align: center;
 max-height: 100%;
  box-sizing: border-box;
  padding-bottom: 18px;
}

.race-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
  align-items: center;
}

/* === BOTTOM NAVIGATION BAR === */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #fff;
  border-top: 1px solid #ccc;
  display: flex;
  justify-content: space-evenly;
  padding: 0.5rem 0;
  z-index: 999;
}

.tab-bar button {
  background: none;
  border: none;
  font-size: 0.85rem;
  color: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-bar button:hover {
  background-color: #f2f2f2;
  border-radius: 10px;
}

.tab-bar span:first-child {
  font-size: 1.3rem;
  margin-bottom: 0.2rem;
}

/* === TOP TOOLBAR === */
.top-tool-bar {

  top: 75px;
  z-index: 998;
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 0.5rem;
  background-color: #fff;
  border-bottom: 1px solid #ccc;
}

.top-nav-content button {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.4rem 0.6rem;
  transition: all 0.2s ease;
}

.top-nav-content button:hover {
  background: #eee;
  border-radius: 6px;
}

.top-tool-bar button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.95rem;
  padding: 0.4rem 0.6rem;
  background: none;
  border: none;
  cursor: pointer;
}


#scratchpad {
  width: 100%;
  padding: 0.5rem;
  margin-top: 1rem;
}

/* Buttons */
.emx-btn { padding: 0.5rem 0.9rem; border-radius: 8px; border: 1px solid transparent; cursor: pointer; font: inherit; }
.emx-btn-primary { background: #ff6300; color: #fff; border-color: #ff6300; }
.emx-btn-primary:hover { filter: brightness(0.95); }
.emx-btn-ghost { background: transparent; color: #ff6300; border: 1px solid #ff6300; }
.emx-btn-ghost:hover { background: rgba(255,99,0,0.08); }
.emx-btn-block { width: 100%; }

/* Modal */
.emx-modal[hidden] { display: none !important; }
.emx-modal__backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99998; }
.emx-modal__dialog { position: fixed; inset: 0; margin: auto; width: 100%; max-width: 360px; background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); padding: 1rem; z-index: 99999; }
.emx-modal__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.emx-modal__close { background: transparent; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; }

.emx-form label { display: block; margin-bottom: 0.75rem; }
.emx-form span { display: block; font-size: 0.9rem; margin-bottom: 0.25rem; color: #333; }
.emx-form input { width: 100%; padding: 0.6rem 0.7rem; border: 1px solid #ccc; border-radius: 8px; font: inherit; }
.emx-error { color: #b00020; margin-top: 0.5rem; }

/* Profile box */
.emx-profile { margin: 0.5rem 0; }
.emx-profile__box { border: 1px solid #ddd; border-radius: 12px; padding: 1rem; background: #fff; }


/* === FIX TOP NAV BAR WRAPPING === */
#topNavContent {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  white-space: nowrap;
  gap: 0.5rem;
  justify-content: flex-start; /* or space-between */
  padding: 0.25rem 0.5rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Hide scrollbars on mobile */
#topNavContent::-webkit-scrollbar {
  display: none;
}
#topNavContent {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Shrink buttons and prevent breaking */
#topNavContent button {
  flex-shrink: 1;
  white-space: normal;
  font-size: 0.85rem;
  padding: 0.3rem 0.4rem;
  min-width: 80px;
  text-align: center;
}


/* === MEDIA QUERIES === */
@media (max-width: 600px) {
  #home-section {
    border-radius: 0;
    box-shadow: none;
  }

  .tab-bar span:first-child {
    font-size: 1rem;
  }
}

.auth-links {
  display: flex;
  justify-content: center;
  gap: 8px;           /* space between buttons */
  flex-wrap: wrap;
  margin-top: 8px;    /* space above the row */
}
.auth-links button {
  padding: 6px 10px;  /* space inside buttons */
}

/* === Profile selector container === */
.pf-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem; /* space between cards */
  justify-content: center;
}

/* === Profile selector cards === */
.pf-selector-section {
  margin: 1rem 0;
  padding: 0.75rem;
  background: #f7f7f7;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.pf-selector .pf-card {
  flex: 1 1 120px;        /* grow, shrink, minimum width 120px */
  min-height: 70px;
  padding: 0.75rem;
  font-size: 1rem;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  cursor: pointer;
}

/* Active card emphasis */
.pf-selector .pf-card.active {
  border: 2px solid var(--emx-orange, #ff6600);
  box-shadow: 0 0 6px rgba(255,102,0,0.5);
}

/* === Responsive tweaks === */
@media (max-width: 600px) {
  .pf-selector {
    gap: 0.4rem;
  }
  .pf-selector .pf-card {
    flex: 1 1 100px;     /* allow smaller cards */
    min-height: 60px;
    font-size: 0.9rem;
    padding: 0.5rem;
  }
}

@media (max-width: 400px) {
  .pf-selector .pf-card {
    flex: 1 1 80px;      /* shrink more on very small screens */
    font-size: 0.8rem;
    min-height: 55px;
  }
}
