/* Etusivun kilpailulista: sama ulkoasu kuin sovelluksen RacesScreen
   (pointsapp/lib/screens/races_screen.dart + theme/liquid_glass.dart).
   Arvot on kopioitu sovelluksesta, joten muuta niitä yhdessä. */

:root {
  --navy: #003871;
  --ink: #17212B;
  --canvas: #F4F7FB;
  --stripe: rgba(30, 90, 200, .05);
  --row-text: rgba(0, 0, 0, .87);
  --clear-tint: rgba(255, 255, 255, .66);
  --regular-tint: rgba(255, 255, 255, .95);
}

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  /* LiquidBackground: kaksi haaleaa värikenttää vaalealla pohjalla. */
  background-color: var(--canvas);
  background-image:
    radial-gradient(circle at -5% 0%, #DCE8F7 0, rgba(220, 232, 247, 0) 110vmin),
    radial-gradient(circle at 110% 80%, rgba(227, 230, 246, .5) 0, rgba(227, 230, 246, 0) 100vmin);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 750px;
  margin: 0 auto;
  padding: 64px 10px 100px; /* _TopBar.height ylhäällä */
  box-sizing: border-box;
}

/* _Logo */
.logo-link {
  display: flex;
  justify-content: center;
  padding-bottom: 20px;
}
.logo-link img {
  width: 180px;
  height: 101px;
  object-fit: contain;
}

/* GlassSurface: läpikuultava sävy, yläreunan kiilto ja ohut reunaviiva. */
.glass {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 0 2px rgba(0, 56, 113, .04),
    0 0 20px rgba(0, 56, 113, .07),
    inset 0 0 0 .5px rgba(0, 56, 113, .08),
    inset 1px 1px 0 rgba(255, 255, 255, .9);
}

/* _StatusLegend */
.status-legend-wrap {
  display: flex;
  justify-content: center;
  padding: 0 8px 12px;
}
.status-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px 10px;
  padding: 7px 14px;
  background: linear-gradient(rgba(255, 255, 255, .76), var(--clear-tint) 50%);
  box-shadow:
    0 0 1px rgba(0, 56, 113, .02),
    0 0 10px rgba(0, 56, 113, .035),
    inset 0 0 0 .5px rgba(0, 56, 113, .08),
    inset 1px 1px 0 rgba(255, 255, 255, .9);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  white-space: nowrap;
}
.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.legend-color.na        { background: #8B8B8B; }
.legend-color.not-start { background: #FF0000; }
.legend-color.ongoing   { background: #FFAA00; }
.legend-color.completed { background: #11FF00; }

/* Taulukkokortti */
.race-card {
  background: linear-gradient(rgba(255, 255, 255, .965), var(--regular-tint) 50%);
}

.race-row {
  display: grid;
  grid-template-columns: 13fr 8fr 10fr 35fr 10fr 13fr 8px;
  align-items: center;
  height: 40px;
  font-size: 12px;
  color: var(--row-text);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.race-row.upcoming {
  grid-template-columns: 19fr 8fr 10fr 29fr 10fr 13fr 8px;
}

.race-row > .cell {
  min-width: 0;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.race-row > .center { text-align: center; }

.race-head {
  height: 34px;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
}

.race-row.striped { background: var(--stripe); }
a.race-row { cursor: pointer; transition: background-color .15s; }
a.race-row:hover { background-color: rgba(0, 56, 113, .06) !important; }
a.race-row:active { background-color: rgba(0, 56, 113, .12) !important; }

.race-row.upcoming.data { opacity: .55; cursor: default; }
.race-row .date-cell { font-size: 11px; text-overflow: clip; }

/* CountryFlag(size: 24): 24×18, pyöristys 2, harmaa reuna */
.flag-cell {
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}
.flag-icon {
  display: block;
  width: 24px;
  height: 18px;
  box-sizing: border-box;
  border: 1px solid #858585;
  border-radius: 2px;
  object-fit: cover;
}
.flag-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 18px;
  box-sizing: border-box;
  border: 1px solid #858585;
  border-radius: 2px;
  font-size: 8px;
}

/* raceStatusColor */
.status-bar { width: 8px; height: 100%; background: #8B8B8B; }
.status-bar.phase-0, .status-bar.phase-2 { background: #E53935; }
.status-bar.phase-1, .status-bar.phase-3 { background: #FFA000; }
.status-bar.phase-4 { background: #18A558; }

.upcoming-heading {
  padding: 12px;
  background: rgba(0, 56, 113, .08);
  color: #505A66;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

/* EmptyView / lataus */
.race-message {
  padding: 26px 24px;
  text-align: center;
}
.race-message h2 {
  margin: 12px 0 6px;
  color: var(--navy);
  font-size: 17px;
}
.race-message p {
  margin: 0;
  color: #607D8B;
  font-size: 13px;
}
.race-message svg { color: #607D8B; }
.spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto;
  border: 3px solid rgba(0, 56, 113, .15);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-links {
  margin: 20px 0 0;
  text-align: center;
  font-size: 14px;
}
.page-links a {
  color: var(--navy);
  text-decoration: none;
  font-weight: 600;
}
.page-links.small { margin: 24px 0; font-size: 13px; }
.page-links.small a { font-weight: 400; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
