    body {
      font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
      margin: 0px;
      background: #ffffff;
      overflow-x: hidden;
    }

    .container {
      max-width: 750px;
      margin: 0 auto;
      background: white;
      padding: 6px;
      border-radius: 8px;
      margin-bottom: 100px;
    }

    #results-table {
       width: 100%;
       table-layout: fixed;
       border-collapse: collapse;
       border: 1px solid #ddd;
    }

    h2 {
      margin-top: 0;
      color: #333;
    }

    .race-info {
      margin-bottom: 15px;
      padding: 10px;
      background: #ffffff;
      border-radius: 4px;
    }

    .race-info p {
      margin: 5px 0;
      font-size: 14px;
    }

    
    /* ── Race Stats ─────────────────────────────────── */
.race-stats {
  margin: 8px 0 12px;
  font-size: 13px;
}

.race-stats details summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 600;
  padding: 6px 4px;
  user-select: none;
  list-style: none;
}

.race-stats details summary::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid currentColor;
  transition: transform 0.15s ease;
}

.race-stats details[open] summary::before {
  transform: rotate(90deg);
}

.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.stats-section {
  flex: 1 1 160px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 8px 10px;
}

.stats-section h4 {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.stat-label { opacity: 0.75; }
.stat-value { font-weight: 600; }

/* oewnfiwodvnsodvnwovndeovfneovn3eovneonvo */

    table {
      border-collapse: collapse;
      width: 100%;
      font-size: 16px;
    }

    /* Prevent colspan cells from affecting column widths */
    table[colspan] {
      width: 100% !important;
    }

    th, td {
      border-bottom: 1px solid #ddd;
      padding: 6px;
      text-align: left;
      box-sizing: border-box;
    }

    th {
      background: #003871;
      color: white;
      font-weight: 600;
      position: sticky;
      top: 0;
      z-index: 10;
      font-size: 16px;
    }

    #race-points-header:hover {
      background: #34495e;
      transition: background 0.2s ease;
    }

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


    tr.rank-1 {
      color: #000000;
      font-weight: 600;
    }

    tr.dnf {
      background: #ffecec !important;
      color: #900;
    }

    tr.dns {
      background: #f3f3f3 !important;
      color: #666;
    }

    tr.dsq {
      background: #fff3cd !important;
      color: #900;
    }
    
    tr.dqp {
      background: #ffe8cc !important;
      color: #cc6600;
      font-style: italic;
    }
    
    /* Kierroskohtaiset DNF/DNS/DSQ tyylit */
    tr.dnf-1, tr.dnf-2 {
      background: #ffecec !important;
      color: #900;
    }
    
    tr.dns-1, tr.dns-2 {
      background: #f3f3f3 !important;
      color: #666;
    }
    
    tr.dsq-1, tr.dsq-2 {
      background: #fff3cd !important;
      color: #900;
    }
    
    tr.dqp-1, tr.dqp-2 {
      background: #ffe8cc !important;
      color: #cc6600;
      font-style: italic;
    }

    .updated {
      margin-bottom: 15px;
      padding: 8px 12px;
      font-size: 12px;
      color: #555;
      background: #e3f2fd;
      border-left: 4px solid #2196F3;
      border-radius: 4px;
    }

    .rank-1-int {
      color: #000000;
      font-weight: 600;
    }

    td.name {
      white-space: nowrap;
      overflow: hidden;
      position: relative;
      z-index: 1;
    }
    
    /* Explicit column widths (proportional) */
:root {
  /* Based on desktop pixel widths: 43,43,300,58,68,93,103 (visible columns) */
  --c1: 6.073%;
  --c2: 8.073%;
  --c3: 38.373%;
  --c4: 8.192%;
  --c6: 11.605%;
  --c7: 13.136%;
  --c8: 14.548%;
}

/* Keep the same column proportions at all widths */
#results-table { table-layout: fixed; width: 100%; }

th:nth-child(1), td:nth-child(1) { width: var(--c1); }
th:nth-child(2), td:nth-child(2) { width: var(--c2); }
th:nth-child(3), td:nth-child(3) { width: var(--c3); }
th:nth-child(4), td:nth-child(4) { width: var(--c4); }

/* hidden total column */
th:nth-child(5), td:nth-child(5) {
  width: 0 !important;
  padding: 0 !important;
  border: none !important;
}

/* Points columns */
th:nth-child(6), td:nth-child(6) { width: var(--c6); }
th:nth-child(7), td:nth-child(7) { width: var(--c7); }
th:nth-child(8), td:nth-child(8) { width: var(--c8); }

/* hidden status column */
th:nth-child(9), td:nth-child(9) {
  width: 0 !important;
  padding: 0 !important;
  border: none !important;
}

/* Allow content to shrink inside fixed layout */
th, td { min-width: 0; }

th.rank,
td.rank {
  text-align: center;
  font-weight: 600;
}

th.time,
td.time {
  text-align: center;
  padding-left: 2px;
  padding-right: 2px;
  white-space: nowrap;
  font-weight: 600;
}
th.diff,
td.diff {
  text-align: center;
  padding-left: 2px;
  padding-right: 2px;
  white-space: nowrap;
}

th.nation,
td.nation {
  text-align: center;
  padding-left: 2px;
  padding-right: 2px;
  white-space: nowrap;
}

th.bib,
td.bib {
  text-align: center;
}



td.time1 {
  text-align: center;
  padding-left: 2px;
  padding-right: 2px;
  white-space: nowrap;
  color: #666;
}


/* Additional styling for rank and bib cells */
th:first-child,
td.rank {
  font-weight: 600;
}

th:nth-child(2),
td.bib {
  font-weight: 600;
}

@media (min-width: 741px) {
  tr:hover {background: #e9ecef;}
}

/* Responsive typography + padding (width proportions stay the same) */
@media (max-width: 740px) {
  table { font-size: 12px; }
  th { font-size: 11px; }
  th, td { padding: 5px 4px; }
  .race-info p { font-size: 13px; }
}

@media (max-width: 380px) {
  table { font-size: 11px; }
  th { font-size: 11px; }
  th, td { padding: 5px 6px; }
  .status-badge { font-size: 10px; padding: 1px 6px; }
}

    


    .loading {
      text-align: center;
      padding: 40px;
      color: #666;
    }

    .error {
      background: #f8d7da;
      color: #721c24;
      padding: 12px;
      border-radius: 4px;
      margin-bottom: 15px;
    }

    .status-badge {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 3px;
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
    }

    .status-finish {
      background: #d4edda;
      color: #155724;
    }

    .status-start {
      background: #fff3cd;
      color: #856404;
    }

    .status-nextstart {
      background: #d1ecf1;
      color: #0c5460;
    }

    .status-pending {
      background: #e2e3e5;
      color: #383d41;
    }

    .update-controls {
  display: flex;
  flex-direction: column;   /* päällekkäin */
  gap: 8px;
  margin-bottom: 0px;
}

.controls {
  display: flex;
  justify-content: flex-end; /* 👉 oikeaan reunaan */
  gap: 15px;
}


    .checkbox-group {
      display: flex;
      align-items: center;
      gap: 5px;
      cursor: pointer;
      user-select: none;
    }

    .checkbox-group input[type="checkbox"] {
      cursor: pointer;
      width: 12px;
      height: 12px;
    }

    .checkbox-group label {
      cursor: pointer;
      font-size: 13px;
      font-weight: 600;
      color: #333;
    }

    /* Last finisher / last status update indicator */
    .last-event {
      margin-top: 8px;
      padding: 8px 12px;
      font-size: 12px;
      color: #333;
      background: #efefef;
      border-left: 4px solid #ffb300;
      border-radius: 4px;
      margin-bottom: 4px;
      display: none;
    }
    .last-event strong { font-weight: 700; }
    tr.last-event-row {
      outline: 2px solid #ffb300;
      outline-offset: -2px;
      animation: pulseOutline 1.2s ease-in-out infinite;
    }
    @keyframes pulseOutline {
      0%   { outline-color: rgba(255,179,0,1); }
      50%  { outline-color: rgba(255,179,0,0.3); }
      100% { outline-color: rgba(255,179,0,1); }
    }

    /* Expandable athlete details row */
    tr.athlete-row {
      cursor: pointer;
      transition: background 0.2s ease;
    }

    /*tr.athlete-row:hover {
      background: #d4e6f5 !important;
    }*/

    /*tr.athlete-row.expanded {
      background: #cce5ff !important;
      font-weight: 600;
    }*/

    tr.details-row {
      display: none;
      background: #f0f8ff !important;
    }

    tr.details-row.show {
      display: table-row;
    }

    tr.details-row td {
      padding: 0 !important;
      border: none !important;
    }

    .details-content {
      padding: 15px;
      border-left: 4px solid #2196F3;
      overflow-x: auto;
    }

    .details-content h4 {
      margin: 0 0 10px 0;
      color: #003871;
      font-size: 14px;
    }

    .run-details {
      display: inline-block;
      margin-right: 30px;
      margin-bottom: 15px;
      vertical-align: top;
    }

    .run-details h5 {
      margin: 0 0 8px 0;
      color: #555;
      font-size: 13px;
      font-weight: 600;
      border-bottom: 2px solid #27ae60;
      padding-bottom: 4px;
    }

    .run-details table {
      font-size: 11px;
      border: none;
      margin-top: 5px;
    }

    .run-details td {
      border: none;
      padding: 3px 8px;
      background: white !important;
    }

    .run-details td:first-child {
      font-weight: 600;
      color: #555;
    }

    .intermediate-time {
      cursor: pointer;
    }

    .sector-table th {
      background: #16a085 !important;
      font-size: 10px;
    }

    .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;
}

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

/* nää vaa et sai sen pikku playn vittuu mobiilista */
*,
*::before,
*::after {
  box-sizing: border-box;
}

img, table {
  max-width: 100%;
}

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

/* Country highlight */
tr.highlight-nation {
  background-color: #1269f557 !important;
  box-shadow: inset 4px 0 0 #ff9800;
}

/* Athlete-specific highlight (favorite, set via double-click on a row) */
tr.highlight-athlete {
  background-color: #ffd60a3d !important;
  box-shadow: inset 4px 0 0 #ffb300;
}

.fav-star {
  color: #ffb300;
  margin-right: 2px;
}

.flag-icon.active {
  outline: 2px solid #ff9800;
}


td.nation {
  text-align: center;
  padding: 4px;
}

.race-better {
  color: #028821; /* vihreä */
  font-weight: 600;
}

.name .birthyear {
  font-size: 9px;
  opacity: 0.7;
}

/* Match the Feedback Board's understated, underlined view selector. */
#race-views { display: flex; margin: 12px 0 0; border-bottom: 1px solid #e4e9f0; }
#race-views button {
  position: relative; flex: 1; min-width: 0; height: 38px; padding: 0 6px;
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
  color: #7a8491; font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: color .16s ease-out;
}
#race-views button::after {
  content: ''; position: absolute; bottom: 0; left: 24px; right: 24px;
  height: 2px; border-radius: 2px 2px 0 0; background: transparent;
  transition: background-color .18s ease-out;
}
#race-views button[aria-pressed="true"] { color: #003871; font-weight: 700; }
#race-views button[aria-pressed="true"]::after { background: #003871; }
#race-views button:hover { color: #003871; }
#race-views button:focus-visible, #race-startlists:focus-visible { outline: 2px solid #003871; outline-offset: 2px; }
.race-view-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; margin-bottom: 4px; }
#race-view-label { color: #7a8491; font-size: 12px; }
#race-startlists { max-width: 55%; min-height: 40px; padding: 4px 6px; border: 0; background: transparent; color: #003871; font: inherit; font-size: 12px; cursor: pointer; }
