/* Estilo común de las carreras de nombres (carreras/*.html). */
  :root {
    --bg: #fbfaf7;
    --panel: #ffffff;
    --text: #1d1f23;
    --muted: #61656d;
    --faint: #e6e4de;
    --axis: #b9bbbf;
    --year: #1d1f23;
    --btn: #f0eee8;
    --btn-text: #1d1f23;
    --play: #1d1f23;
    --play-text: #ffffff;
    --track: #e2e0da;
    --thumb: #1d1f23;
    --boys-head: #2472cc;
    --girls-head: #c8434e;
    --focus: #1d5fbf;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #141518;
      --panel: #1c1e22;
      --text: #e9e8e4;
      --muted: #a2a5ab;
      --faint: #2d3036;
      --axis: #4a4e56;
      --year: #e9e8e4;
      --btn: #2a2d33;
      --btn-text: #e9e8e4;
      --play: #e9e8e4;
      --play-text: #141518;
      --track: #34373e;
      --thumb: #e9e8e4;
      --boys-head: #6f9cf0;
      --girls-head: #f08a5d;
      --focus: #8fb6ff;
    }
  }
  :root[data-theme="dark"] {
    --bg: #141518;
    --panel: #1c1e22;
    --text: #e9e8e4;
    --muted: #a2a5ab;
    --faint: #2d3036;
    --axis: #4a4e56;
    --year: #e9e8e4;
    --btn: #2a2d33;
    --btn-text: #e9e8e4;
    --play: #e9e8e4;
    --play-text: #141518;
    --track: #34373e;
    --thumb: #e9e8e4;
    --boys-head: #6f9cf0;
    --girls-head: #f08a5d;
    --focus: #8fb6ff;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  }
  main { max-width: 1120px; margin: 0 auto; padding: 4px 16px 48px; }
  a { color: inherit; }
  .back { font-size: 13px; color: var(--muted); text-decoration: none; }
  .back:hover { text-decoration: underline; }
  h1 { font-size: 24px; margin: 6px 0 2px; letter-spacing: -0.01em; }
  .lead { color: var(--muted); margin: 0 0 12px; font-size: 14px; }

  /* .stage crea su propio contexto de apilamiento: el z-index de las barras
     (.row) queda contenido aquí dentro y no compite con el menú de navegación. */
  .stage {
    position: relative;
    isolation: isolate;
    background: var(--panel);
    border: 1px solid var(--faint);
    border-radius: 12px;
    padding: 14px 16px 16px;
  }
  .top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
  .yearbox { line-height: 1; }
  #year {
    font-size: 84px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--year);
    font-variant-numeric: tabular-nums;
  }
  #yearNote { font-size: 12px; color: var(--muted); margin-top: 6px; min-height: 16px; }
  .totals { text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .totals b { color: var(--text); font-weight: 600; }

  .race { display: grid; grid-template-columns: 1fr 34px 1fr; margin-top: 12px; }
  .colhead { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
  .col.boys .colhead { text-align: right; color: var(--boys-head); }
  .col.girls .colhead { color: var(--girls-head); }
  .lane { position: relative; overflow: hidden; }
  .ranks { position: relative; margin-top: 25px; }
  .rank {
    position: absolute; left: 0; right: 0; text-align: center;
    font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
  }
  .axis { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--axis); }
  .col.boys .axis { right: 0; }
  .col.girls .axis { left: 0; }

  .row {
    position: absolute; left: 0; right: 0; top: 0;
    display: flex; align-items: center;
    will-change: transform, opacity;
  }
  .col.boys .row { flex-direction: row-reverse; }
  .bar {
    position: relative;
    height: 100%;
    flex: none;
    display: flex; align-items: center;
    overflow: hidden;
    white-space: nowrap;
  }
  .col.boys .bar { border-radius: 4px 0 0 4px; justify-content: flex-start; }
  .col.girls .bar { border-radius: 0 4px 4px 0; justify-content: flex-end; }
  .bar .nm { font-weight: 650; font-size: 14px; padding: 0 9px; }
  .lab {
    flex: none; white-space: nowrap; padding: 0 8px;
    font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 6px;
  }
  .col.boys .lab { flex-direction: row-reverse; }
  .lab .out { font-weight: 650; font-size: 14px; }
  .lab .pct { font-size: 14px; font-weight: 600; }
  .lab .cnt { font-size: 11px; color: var(--muted); }

  .controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
  button, select {
    font: inherit; font-size: 14px; border: 0; border-radius: 8px;
    background: var(--btn); color: var(--btn-text); padding: 7px 12px; cursor: pointer;
  }
  #play { background: var(--play); color: var(--play-text); font-weight: 650; min-width: 104px; }
  #play.pulse { animation: pulse 1.6s ease-in-out infinite; }
  @keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(120,120,120,.0); } 50% { box-shadow: 0 0 0 6px rgba(120,120,120,.25); } }
  .speed { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
  .timeline { flex: 1 1 260px; min-width: 220px; }
  input[type=range] { width: 100%; margin: 0; accent-color: var(--thumb); cursor: pointer; }
  .ticks { position: relative; height: 16px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .ticks span { position: absolute; transform: translateX(-50%); }
  .note { font-size: 12px; color: var(--muted); margin-top: 12px; }

  @media (max-width: 720px) {
    #year { font-size: 60px; }
    .race { grid-template-columns: 1fr; gap: 18px; }
    .ranks { display: none; }
    .col.boys .colhead { text-align: left; }
    .col.boys .axis { right: auto; left: 0; }
    .col.boys .row { flex-direction: row; }
    .col.boys .lab { flex-direction: row; }
    .col.boys .bar { border-radius: 0 4px 4px 0; justify-content: flex-end; }
    .bar .nm, .lab .out, .lab .pct { font-size: 13px; }
    .totals { text-align: left; }
  }
  @media (prefers-reduced-motion: reduce) { #play.pulse { animation: none; } }

  /* Navegación entre carreras */
  /* La barra de navegación va en su propio nivel, por encima de la animación. */
  .navbar { max-width: 1120px; margin: 0 auto; padding: 14px 16px 0; position: relative; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
  /* El desplegable se coloca respecto a .navbar (no respecto al botón) para que
     en pantallas estrechas no se salga por la derecha. */
  details.races { position: static; font-size: 13px; }
  /* Mismo modelo que los botones ES | EN: caja flexible con el texto centrado en vertical.
     (Como bloque "list-item", el min-height de 40 px se añadía solo por debajo del texto.) */
  details.races summary {
    cursor: pointer; list-style: none; background: var(--btn); color: var(--btn-text);
    border-radius: 8px; padding: 0 12px; user-select: none;
    display: inline-flex; align-items: center; gap: 4px;
    min-height: 40px; box-sizing: border-box; line-height: normal;
  }
  details.races summary::-webkit-details-marker { display: none; }
  details.races summary::after { content: " ▾"; }
  details.races[open] summary::after { content: " ▴"; }
  .races-list {
    position: absolute; top: 100%; right: 0; z-index: 1; margin-top: 6px;
    background: var(--panel); border: 1px solid var(--faint); border-radius: 10px;
    padding: 8px; display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 2px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.18); width: max-content; max-width: calc(100vw - 32px);
  }
  .races-list a { text-decoration: none; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
  .races-list a:hover { background: var(--btn); }
  .races-list a[aria-current="page"] { font-weight: 700; background: var(--btn); }
  .races-list a:first-child { grid-column: 1 / -1; font-weight: 650; }
  .nodata {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    text-align: center; padding: 0 16px; font-size: 13px; color: var(--muted);
    pointer-events: none; opacity: 0; transition: opacity .25s;
  }
  .notes { font-size: 12px; color: var(--muted); margin: 6px 0 0; padding-left: 18px; }
  .notes:empty { display: none; }
  @media (max-width: 720px) { .races-list { left: 0; right: 0; width: auto; max-width: none; grid-template-columns: 1fr 1fr; } }

  /* Accesibilidad */
  .sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .skip {
    position: absolute; left: 16px; top: -48px; z-index: 100;
    background: var(--play); color: var(--play-text); padding: 8px 12px; border-radius: 8px;
  }
  .skip:focus { top: 8px; }
  a:focus-visible, button:focus-visible, select:focus-visible, summary:focus-visible,
  input:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px;
  }
  .controls:focus { outline: none; }
  button, select, summary { min-height: 40px; }
  input[type=range] { min-height: 28px; }

  /* Tabla del año */
  details.yeartable { margin-top: 12px; font-size: 14px; }
  details.yeartable summary {
    cursor: pointer; display: inline-flex; align-items: center;
    background: var(--btn); color: var(--btn-text); border-radius: 8px; padding: 6px 12px;
  }
  .tablewrap { overflow-x: auto; margin-top: 8px; }
  table.top10 { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
  table.top10 caption { text-align: left; font-weight: 650; padding: 4px 0 6px; }
  table.top10 th, table.top10 td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--faint); }
  table.top10 td.num { white-space: nowrap; color: var(--muted); }
  .tablenote { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
  @media (max-width: 420px) {
    main, .navbar { padding-left: 12px; padding-right: 12px; }
    .stage { padding: 12px 10px 14px; }
    #year { font-size: 52px; }
    .controls { gap: 6px; }
    .timeline { flex-basis: 100%; min-width: 0; }
  }

  /* Selector de idioma */
  .navright { display: flex; align-items: center; gap: 8px; }
  .langswitch { display: inline-flex; border: 1px solid var(--faint); border-radius: 8px; overflow: hidden; }
  .langbtn {
    border: 0; border-radius: 0; background: transparent; color: var(--muted);
    font-size: 13px; font-weight: 650; min-width: 40px; min-height: 40px; padding: 4px 8px;
  }
  .langbtn[aria-pressed="true"] { background: var(--play); color: var(--play-text); }
  @media (max-width: 420px) {
    .navbar { gap: 6px; }
    .back { font-size: 12px; }
    details.races summary { padding: 0 10px; }
  }

  /* Nombre del proyecto */
  .navleft { display: flex; flex-direction: column; gap: 2px; }
  .brand { font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
