html, body {
  margin:0;
  padding:0;
  max-width:100%;
  overflow-x:hidden; /* estää sivuttaisscrollin */
  font-family: Arial, sans-serif;
  background:#ffffff;
}

.container {
  width:100%;
  max-width:750px;   /* isoilla näytöillä ei liian leveä */
  margin:0 auto;
  padding:10px;
  box-sizing:border-box;
  margin-bottom: 100px;
}

table {
  width:100%;  
  max-width: 750px;            /* aina ruudun levyinen containerin sisällä */
  table-layout:fixed;      /* pakottaa sarakkeet jakamaan tilan */
  border-collapse:collapse;
  background:white;
  box-shadow:0 2px 4px rgba(0,0,0,0.1);
  border-radius:8px;
  overflow:hidden;
}

th, td {
  padding:8px;
  border-bottom:1px solid #e0e0e0;
  text-align:left;
  font-size:13px;

  white-space:nowrap;       /* ei rivinvaihtoja jotka venyttää */
  overflow:hidden;          /* piilottaa ylivuotavan tekstin */
  text-overflow:ellipsis;   /* näyttää ... jos ei mahdu */
}

th {
  background:#003871;
  color:white;
}

tr:hover {
  background:#f0f4f8;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background:#e9f1fb;
}

tr:nth-child(even) {
      background: #f4f7ff;
    }

.col-codex   { width: 13%; text-align: center;}
.col-nsa     { width: 10%; }
.col-place   { width: 35%; }
.col-gender  { width: 8%;  text-align: center; }
.col-category{ width: 13%; text-align: center; }
.col-disc    { width: 10%; text-align: center; }
.col-status  { width: 1%; text-align: center; }

.status--1 { background-color: #8b8b8b; color: white; }
.status-0 { background-color: #ff0000; color: #333; }
.status-1 { background-color: #ffaa00; color: white; }
.status-2 { background-color: #ff0000; color: white; }
.status-3 { background-color: #ffaa00; color: white; }
.status-4 { background-color: #11ff00; color: white; }


.flag-icon {
  width: 24px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #858585;
  display: inline-block;
  vertical-align: middle;
}

th.col-nsa,
td.col-nsa {
  text-align: center;
  padding: 4px;
  text-overflow: clip;
}

.logo-link {
  display: flex;
  justify-content: center;  /* keskelle vaakasuunnassa */
}

.logo-link img {
  width: 40vw;        /* skaalautuu näytön mukaan */
  max-width: 200px;   /* ei liian iso desktopilla */
  min-width: 120px;   /* ei liian pieni mobiilissa */
  height: auto;
  margin-bottom: 20px;
}

/* Ympyrämuotoiset liput */
.flag-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-block;
  border: 1px solid #000000;
}

.flag-circle .fi {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  display: block;
  transform: scale(1.5); /* Zoomaa lippua sopivasti ympyrän sisään */
}

.col-nsa {
  text-align: center;
}

/*.vittuilu {
  text-align: center;
  font-size: 14px;
  color: #555;
  margin-bottom: 10px;
}*/

.status-legend {
  display: none;
  background: #ffffff;
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 2px;
  font-size: 12px;

  flex-wrap: wrap;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  text-align: center;

}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

/* Desktop */
@media (min-width: 768px) {
  th.col-status{
    width: 20%;
  }

  td.col-status {
    width: 20%;
    font-weight: bold;
  }

  td.col-status[class*="status-"] {
    background-color: transparent !important;
    color: #333 !important;
    width: 20%;
  }

}

/* Mobile */
@media (max-width: 767px) {

  .status-legend {
    display: flex;
    justify-content: center;   /* 👈 keskelle vaakasuunnassa */
    align-items: center;
  }

  .status-header-text {
    display: none;
  }

  .col-status {
    width: 2%;
    min-width: 2%;
    padding: 0;
  }

  .status-text {
    display: none;
  }
}
/* Future competitions are information rows, not navigation links. */
#race-list .upcoming-heading th {
  background: #f0f2f4;
  color: #505a66;
  text-align: center;
  padding: 12px;
  font-size: 14px;
}
#race-list .upcoming-race,
#race-list .upcoming-race:hover {
  background: #f4f5f6;
  color: #68717c;
  cursor: default;
}
#race-list .upcoming-race td { color: #68717c !important; }
#race-list .upcoming-race .flag-icon { filter: grayscale(1); opacity: .65; }
#race-list .upcoming-race .col-status { background: #a0a5ac; }

#race-list .upcoming-race .col-codex { font-size: 11px; white-space: normal; overflow-wrap: normal; }
