:root{
    --ijs-wit:#F3F7F9;
    --kaart-wit:#FFFFFF;
    --diepblauw:#0B3C5D;
    --diepblauw-donker:#082C45;
    --ijsblauw:#1C7FB5;
    --oranje:#E8600C;
    --goud:#C9971F;
    --zilver:#8D98A3;
    --brons:#B5651D;
    --tekst:#132029;
    --tekst-zacht:#5B6B75;
    --rand:#DCE6EA;
    --radius:10px;
    --bib-chars:3; /* fallback als de pagina de variabele niet zet; uitslag.php berekent 'm per wedstrijd */
    --bib-breedte: calc(var(--bib-chars) * 1ch + 4px);
  }
  *{box-sizing:border-box;}
  body{
    margin:0;
    background:var(--ijs-wit);
    color:var(--tekst);
    font-family:'Inter',system-ui,sans-serif;
    -webkit-font-smoothing:antialiased;
  }
  a{color:inherit;}

  /* ---------- Header ---------- */
  header.top{
    background:linear-gradient(160deg,var(--diepblauw) 0%,var(--diepblauw-donker) 100%);
    color:#fff;
  }
  .top-binnen{
    max-width:760px; margin:0 auto;
    padding:14px 16px 18px;
  }
  .breadcrumb{
    display:flex; align-items:center; gap:6px;
    font-size:13px; color:#BFD6E4; margin-bottom:10px;
  }
  .breadcrumb img{height:14px; vertical-align:middle;}

  .categorie-tabs{
    display:flex; gap:6px; overflow-x:auto;
    padding-bottom:12px; scrollbar-width:none;
  }
  .categorie-tabs::-webkit-scrollbar{display:none;}
  .categorie-tabs a{
    flex:0 0 auto;
    display:flex; flex-direction:column; align-items:center; justify-content:center;
    text-decoration:none;
    font-family:'Barlow Condensed',sans-serif;
    font-weight:600; font-size:13px; letter-spacing:.02em;
    line-height:1.2;
    color:#CFE2ED;
    padding:5px 12px;
    border-radius:14px;
    border:1px solid rgba(255,255,255,.18);
  }
  .categorie-tabs a.actief{
    background:var(--oranje);
    border-color:var(--oranje);
    color:#fff;
  }

  .competitie-balk{
    display:flex; align-items:center; gap:6px;
    margin:10px 0 0;
  }
  .competitie-chips{
    display:flex; gap:5px; overflow-x:auto; scrollbar-width:none;
    flex:1 1 auto;
  }
  .competitie-chips::-webkit-scrollbar{display:none;}
  .competitie-chip{
    flex:0 0 auto;
    text-decoration:none;
    font-family:'Barlow Condensed',sans-serif; font-weight:600; font-size:13px;
    color:#BFD6E4;
    background:rgba(255,255,255,.08);
    border:1px solid rgba(255,255,255,.16);
    border-radius:999px;
    padding:4px 10px;
    white-space:nowrap;
  }
  .competitie-chip.actief{
    background:#fff; color:var(--diepblauw);
    font-weight:700;
    border-color:#fff;
  }
  .competitie-pijl{
    flex:0 0 auto;
    display:flex; align-items:center; justify-content:center;
    width:24px; height:24px;
    color:#CFE2ED; text-decoration:none;
    font-size:16px;
  }
  .competitie-pijl[aria-disabled="true"]{opacity:.3; pointer-events:none;}

  .wedstrijd-titel{
    padding:2px 0 4px;
  }
  .wedstrijd-titel h1{
    font-family:'Barlow Condensed',sans-serif;
    font-weight:800; font-size:clamp(24px,6vw,34px);
    letter-spacing:.01em;
    margin:0 0 6px;
    line-height:1.05;
  }
  .wedstrijd-meta{
    display:flex; flex-wrap:wrap; gap:4px 14px;
    font-size:13.5px; color:#BFD6E4;
  }
  .wedstrijd-meta strong{color:#fff; font-weight:600;}
  .eindtijd-badge{
    font-weight:700; color:#fff;
    background:rgba(255,255,255,.14);
    border-radius:6px; padding:1px 8px;
  }

  /* ---------- Sub-tabs (klassementen) ---------- */
  nav.subtabs{
    background:var(--kaart-wit);
    border-bottom:1px solid var(--rand);
  }
  .subtabs-binnen{
    max-width:760px; margin:0 auto;
    display:flex; gap:2px;
    padding:0 12px;
    overflow-x:auto;
  }
  nav.subtabs button{
    all:unset; cursor:pointer;
    font-family:'Barlow Condensed',sans-serif;
    font-weight:700; font-size:15.5px;
    padding:12px 14px 10px;
    color:var(--tekst-zacht);
    border-bottom:3px solid transparent;
    white-space:nowrap;
  }
  nav.subtabs button.actief{
    color:var(--diepblauw);
    border-bottom-color:var(--oranje);
  }

  main{max-width:760px; margin:0 auto; padding-bottom:16px;}

  .paneel{display:none;}
  .paneel.actief{display:block;}

  /* ---------- Tabel ---------- */
  .tabel-wrap{
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
  }
  table{
    border-collapse:collapse;
    width:100%;
    min-width:380px;
    font-size:14px;
  }
  thead th{
    position:sticky; top:0;
    background:var(--ijs-wit);
    text-align:left;
    font-family:'Barlow Condensed',sans-serif;
    font-weight:700; font-size:12.5px;
    letter-spacing:.04em; text-transform:uppercase;
    color:var(--tekst-zacht);
    padding:7px 8px;
    border-bottom:1px solid var(--rand);
    z-index:5;
  }
  th.kol-rijder{padding-left: calc(8px + 24px + 3px + var(--bib-breedte) + 3px + 18px + 3px);}
  th.kol-rijder, td.kol-rijder{
    position:sticky; left:0;
    background:var(--ijs-wit);
    z-index:6;
    box-shadow:2px 0 4px -2px rgba(0,0,0,.12);
    width:225px; min-width:225px;
  }
  thead th.kol-rijder{ z-index:9; }
  td.kol-rijder{background:var(--kaart-wit);}

  tbody tr{background:var(--kaart-wit);}
  tbody tr.even{background:#FAFCFD;}
  tbody tr.even td.kol-rijder{background:#FAFCFD;}

  td{
    padding:6px 8px;
    border-bottom:1px solid var(--rand);
    vertical-align:middle;
  }

  /* plaatsing badge */
  .pl-badge{
    flex:0 0 24px; width:24px; height:23px; padding:0;
    display:flex; align-items:center; justify-content:center;
    background:transparent;
  }
  .pl-badge-vlak{
    width:100%; height:100%;
    display:flex; align-items:center; justify-content:center;
    clip-path:polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    font-family:'Barlow Condensed',sans-serif; font-weight:700; font-size:13px;
    background:#EAF1F4; color:var(--diepblauw);
  }
  #paneel-dag_oranje tr[data-rank="1"] .pl-badge-vlak{background:var(--goud); color:#fff;}
  #paneel-dag_oranje tr[data-rank="2"] .pl-badge-vlak{background:var(--zilver); color:#fff;}
  #paneel-dag_oranje tr[data-rank="3"] .pl-badge-vlak{background:var(--brons); color:#fff;}
  #paneel-klassement_oranje tr[data-rank="1"] .pl-badge-vlak{
    background:var(--oranje); color:#fff;
    clip-path:polygon(35% 0%, 65% 0%, 65% 8%, 88% 8%, 100% 30%, 100% 55%, 82% 45%, 78% 100%, 22% 100%, 18% 45%, 0% 55%, 0% 30%, 12% 8%, 35% 8%);
  }
  #paneel-klassement_wit tr[data-rank="1"] .pl-badge{
    background:var(--diepblauw); padding:2px;
    clip-path:polygon(35% 0%, 65% 0%, 65% 8%, 88% 8%, 100% 30%, 100% 55%, 82% 45%, 78% 100%, 22% 100%, 18% 45%, 0% 55%, 0% 30%, 12% 8%, 35% 8%);
  }
  #paneel-klassement_wit tr[data-rank="1"] .pl-badge-vlak{
    background:#fff; color:var(--diepblauw);
    clip-path:polygon(35% 0%, 65% 0%, 65% 8%, 88% 8%, 100% 30%, 100% 55%, 82% 45%, 78% 100%, 22% 100%, 18% 45%, 0% 55%, 0% 30%, 12% 8%, 35% 8%);
  }

  /* Witte hexagon met blauw randje: positie in het jongerenklassement,
     alleen getoond in de Daguitslag, achter de naam van de rijder. */
  .jongere-badge{
    flex:0 0 auto;
    display:inline-flex; align-items:center; justify-content:center;
    width:20px; height:19px; padding:1px;
    background:var(--diepblauw);
    clip-path:polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  }
  .jongere-badge-vlak{
    width:100%; height:100%;
    display:flex; align-items:center; justify-content:center;
    background:#fff; color:var(--diepblauw);
    clip-path:polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    font-family:'Barlow Condensed',sans-serif; font-weight:700; font-size:11px;
  }

  .rijder-cel{display:flex; align-items:center; gap:3px; cursor:pointer;}
  .bib-cel{
    flex:0 0 var(--bib-breedte); width:var(--bib-breedte);
    font-family:'Barlow Condensed',sans-serif; font-weight:700; font-size:11.5px;
    color:var(--ijsblauw); letter-spacing:.02em;
    text-align:center;
  }
  .naam{
    flex:1 1 auto; min-width:0;
    display:block;
    font-weight:600; font-size:14px; color:var(--tekst);
    text-decoration:none;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }
  a.naam{color:var(--diepblauw);}
  a.naam:hover, a.naam:focus-visible{color:var(--ijsblauw); text-decoration:underline;}
  .bib{
    font-family:'Barlow Condensed',sans-serif; font-weight:700; font-size:11px;
    color:var(--ijsblauw); background:#E7F2F8;
    border-radius:5px; padding:1px 5px; letter-spacing:.02em;
  }
  .vlag-buiten{
    flex:0 0 18px; width:18px; height:14px;
    display:inline-flex; align-items:center; justify-content:center;
    background:rgba(19,32,41,.18); /* dit is het "randje" - iets groter dan de vlag zelf */
    padding:1px;
    clip-path:polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  }
  .vlag{
    width:100%; height:100%; object-fit:cover;
    clip-path:polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  }
  .vlag-leeg{background:var(--rand); display:inline-block;}
  .punten{
    font-variant-numeric:tabular-nums; font-weight:700; text-align:right;
    white-space:nowrap; width:42px; min-width:42px;
    padding-left:0;
  }
  .kol-rnd{
    text-align:center;
    width:20px; min-width:20px;
    padding:6px 0 6px 6px;
  }
  .rnd-chip{
    display:inline-flex; align-items:center; justify-content:center;
    vertical-align:middle;
    height:19px; box-sizing:border-box;
    font-family:'Barlow Condensed',sans-serif; font-weight:700; font-size:11px;
    color:var(--ijsblauw); background:#E7F2F8;
    border-radius:4px; padding:0 6px; letter-spacing:.02em;
  }
  .ploeg{
    color:var(--tekst-zacht); font-size:13px;
  }
  .ploeg-cel{display:inline-flex; align-items:center; gap:5px; max-width:100%; min-width:0;}
  .ploeg-kit, .ploeg-kit-fallback{flex:0 0 19px; width:19px; height:19px; border-radius:2px;}
  .ploeg-kit{object-fit:contain;}
  .ploeg-kit-fallback{
    display:none; align-items:center; justify-content:center;
    background:var(--ijsblauw); color:#fff;
    font-size:9px; font-weight:700;
    clip-path:polygon(35% 0%, 65% 0%, 65% 8%, 88% 8%, 100% 30%, 100% 55%, 82% 45%, 78% 100%, 22% 100%, 18% 45%, 0% 55%, 0% 30%, 12% 8%, 35% 8%);
  }
  .ploeg-cel .ploeg-kit-fallback{color:#fff;}
  .ploeg-tekst{
    min-width:0;
    display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
    overflow:hidden; line-height:1.25;
  }

  .info-knop{
    display:inline-flex; align-items:center; justify-content:center;
    width:14px; height:14px;
    border-radius:50%;
    background:var(--rand); color:var(--tekst-zacht);
    font-size:10px; font-weight:700; font-style:italic;
    text-decoration:none; font-family:Georgia,serif;
    vertical-align:middle;
  }
  .info-knop:hover{background:var(--ijsblauw); color:#fff;}
  .prive-tekst{font-style:italic; font-weight:400; color:var(--tekst-zacht);}

  /* extra kolom die pas op bredere schermen verschijnt */
  .kol-woonplaats{display:none;}

  footer.legenda{
    padding:12px 16px 26px; font-size:12.5px; color:var(--tekst-zacht);
    display:flex; flex-wrap:wrap; gap:6px 14px;
  }
  footer.legenda span{display:inline-flex; align-items:center; gap:5px;}
  .dot{width:9px; height:9px; border-radius:50%; display:inline-block;}

  .ad-slot{
    margin:4px 16px;
    padding:2px 10px 4px;
    text-align:center;
  }
  .ad-slot.klein{min-height:50px;}
  .ad-slot.groot{min-height:250px;}

  /* Twee vaste (niet-responsive) advertentie-eenheden voor het bovenste vak:
     op elk moment is er maar één zichtbaar. Vaste formaten voorkomen dat
     Google alsnog een groter native formaat kiest zoals bij de responsive
     versie gebeurde. */
  .ad-boven-mobiel{ display:inline-block; }
  .ad-boven-desktop{ display:none !important; }
  @media (min-width:500px){
    .ad-boven-mobiel{ display:none !important; }
    .ad-boven-desktop{ display:inline-block; }
  }

  .merk-badge{
    position:fixed;
    right:12px; bottom:calc(12px + env(safe-area-inset-bottom,0px));
    z-index:50;
    display:flex; align-items:center; gap:6px;
    background:var(--diepblauw);
    color:#fff; text-decoration:none;
    padding:6px 11px 6px 6px;
    border-radius:999px;
    box-shadow:0 2px 8px rgba(0,0,0,.22);
    opacity:.94;
  }
  .merk-badge:hover, .merk-badge:active{opacity:1;}
  .merk-mark{
    flex:0 0 auto;
    width:19px; height:19px;
    border-radius:50%;
    background:var(--oranje);
    color:#fff;
    display:flex; align-items:center; justify-content:center;
    font-family:'Barlow Condensed',sans-serif; font-weight:800; font-size:12px;
  }
  .merk-tekst{
    font-family:'Barlow Condensed',sans-serif;
    font-weight:700; font-size:12.5px; letter-spacing:.01em;
    white-space:nowrap;
  }

  .naam{cursor:pointer;}
  .naam:hover, .naam:focus-visible{text-decoration:underline;}

  tr.ploeg-highlight{background:#EAF3FA;}
  tr.ploeg-highlight td.kol-rijder{background:#EAF3FA;}
  .ploeg-cel{cursor:pointer;}
  .ploeg-cel:hover .ploeg-tekst{text-decoration:underline;}

  .detail-rij{display:none;}
  .detail-rij.open{display:table-row;}
  .detail-rij td{padding:0; border-bottom:1px solid var(--rand);}
  .mini-profiel{
    position:sticky; left:0;
    display:flex; align-items:flex-start; gap:12px;
    padding:12px 8px 16px 8px;
    background:#F9FBFC;
  }
  .mini-foto-wrap{
    flex:0 0 auto;
    position:relative;
    width:69px; height:104px;
    border-radius:8px; overflow:hidden;
  }
  .mini-foto{width:100%; height:100%; object-fit:cover; display:block;}
  .mini-foto-fallback{
    position:absolute; inset:0;
    display:none; align-items:center; justify-content:center;
    background:var(--diepblauw); color:#fff;
    font-family:'Barlow Condensed',sans-serif; font-weight:800; font-size:24px;
  }
  .mini-info{flex:1 1 auto; min-width:0;}
  .mini-naam{font-weight:700; font-size:15px; color:var(--tekst); margin-bottom:6px;}
  .mini-velden{display:flex; flex-direction:column; gap:5px; margin-bottom:10px;}
  .mini-veld{display:flex; align-items:center; gap:6px; font-size:13px;}
  .mini-veld span{color:var(--tekst-zacht); flex:0 0 auto;}
  .mini-veld b{color:var(--tekst); font-weight:600; display:inline-flex; align-items:center; gap:5px;}
  .mini-veld .ploeg-cel{font-size:13px;}
  .mini-link{
    display:inline-block;
    color:var(--diepblauw); font-weight:700; font-size:13px;
    text-decoration:none;
  }
  .mini-link:hover{text-decoration:underline;}

  @media (min-width:560px){
    table{font-size:14.5px;}
  }

  @media (min-width:680px){
    th.kol-rijder, td.kol-rijder{width:265px; min-width:265px;}
    .kol-woonplaats{
      display:table-cell;
      color:var(--tekst-zacht); font-size:13px;
      max-width:130px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
    }
    .categorie-tabs{justify-content:center;}
    .competitie-balk{justify-content:center;}
    .competitie-chips{flex:0 1 auto;}
    .wedstrijd-titel{text-align:center;}
    .wedstrijd-meta{justify-content:center;}
  }
