/* ==========================================================================
   Cycling For Fun - responsive shell
   Loaded after cyclingmanager.css. Night-race navy, leader's-jersey yellow,
   team red; condensed race-signage type. The stage-profile line under the
   top bar is the one decorative element.
   ========================================================================== */

:root {
  --night: #0a1238;        /* page background (brand navy, lifted for legibility) */
  --night-2: #121d4d;      /* panels */
  --night-3: #1c2a63;      /* raised / hover */
  --rule: #2c3b7a;         /* borders */
  --maillot: #ffd200;      /* leader's jersey: primary accent */
  --maillot-ink: #241c00;  /* text on the accent */
  --accent-hover: #ffe14d;
  --team-red: #b4142c;     /* top bar, alerts */
  --bar-ink: #ffffff;      /* text on the top bar */
  --text: #eef1fb;
  --muted: #aab4da;
  --link: #ffd200;
  --link-hover: #fff3a8;
  --input-bg: #ffffff;
  --input-ink: #111111;
  --focus: #ffd200;
  --stripe: rgba(255, 255, 255, .04);
  --shadow: 0 14px 30px rgba(0, 0, 0, .45);
  --radius: 10px;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: dark;
}

/* Light: daylight stage start - white panels, team red bar, navy ink */
:root[data-theme="light"] {
  --night: #eef1f8;
  --night-2: #ffffff;
  --night-3: #e1e6f4;
  --rule: #c5cde6;
  --maillot: #ffd200;
  --maillot-ink: #241c00;
  --accent-hover: #ffe14d;
  --team-red: #b4142c;
  --bar-ink: #ffffff;
  --text: #141a3d;
  --muted: #4d5682;
  --link: #1f3fb0;
  --link-hover: #b4142c;
  --input-bg: #ffffff;
  --input-ink: #141a3d;
  --focus: #1f3fb0;
  --stripe: #f3f5fb;
  --shadow: 0 10px 24px rgba(20, 26, 61, .12);
  color-scheme: light;
}

/* High contrast: pure black and white, yellow for anything you can act on */
:root[data-theme="contrast"] {
  --night: #000000;
  --night-2: #000000;
  --night-3: #1f1f1f;
  --rule: #ffffff;
  --maillot: #ffff00;
  --maillot-ink: #000000;
  --accent-hover: #ffffff;
  --team-red: #000000;
  --bar-ink: #ffffff;
  --text: #ffffff;
  --muted: #ffffff;
  --link: #ffff00;
  --link-hover: #00ffff;
  --input-bg: #000000;
  --input-ink: #ffffff;
  --focus: #00ffff;
  --stripe: #141414;
  --shadow: none;
  color-scheme: dark;
}

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--night) !important;
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
}
body a { color: var(--link); }
body a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- top bar ------------------------------------------------------------ */
.cff-top {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px 22px;
  background: var(--team-red);
  color: var(--bar-ink);
}
.cff-wordmark {
  font-family: var(--display);
  font-style: italic;
  font-weight: 800;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--bar-ink) !important;
  text-decoration: none;
  white-space: nowrap;
}
.cff-clock {
  margin-left: auto;
  font-family: var(--display);
  font-weight: 500;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: var(--bar-ink);
  opacity: .9;
}
.cff-profile {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  width: 100%;
  height: 24px;
  fill: var(--night);
}
.cff-menu-btn {
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--bar-ink);
  border-radius: 999px;
  background: transparent;
  color: var(--bar-ink);
  font: 700 17px var(--display);
  cursor: pointer;
}
.cff-menu-btn__bars,
.cff-menu-btn__bars::before,
.cff-menu-btn__bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  content: "";
}
.cff-menu-btn__bars { position: relative; }
.cff-menu-btn__bars::before { position: absolute; top: -6px; }
.cff-menu-btn__bars::after { position: absolute; top: 6px; }

/* ---- navigation --------------------------------------------------------- */
.cff-nav { background: var(--night); border-bottom: 1px solid var(--rule); position: relative; z-index: 50; }
.cff-nav ul { list-style: none; margin: 0; padding: 0; }
.cff-nav__groups { display: flex; flex-wrap: wrap; padding: 0 12px; }
.cff-nav__group summary,
.cff-nav__logout a {
  display: block;
  padding: 12px 14px;
  font: 700 18px var(--display);
  color: var(--text);
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}
.cff-nav__group summary::-webkit-details-marker { display: none; }
.cff-nav__group summary::after { content: " \25BE"; color: var(--muted); font-size: 14px; }
.cff-nav__group[open] summary,
.cff-nav__group summary:hover { color: var(--maillot); }
.cff-nav__group { position: relative; }
.cff-nav__group ul {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  padding: 6px 0;
  background: var(--night-2);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--maillot);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
}
.cff-nav__group li a {
  display: block;
  padding: 9px 16px;
  color: var(--text);
  text-decoration: none;
}
.cff-nav__group li a:hover { background: var(--night-3); color: var(--maillot); }
.cff-nav__logout { margin-left: auto; }
.cff-nav__admin a { display: block; padding: 12px 14px; font: 700 18px var(--display); color: var(--maillot); text-decoration: none; }
.cff-nav__logout a { color: var(--muted); text-decoration: none; }

/* ---- shell -------------------------------------------------------------- */
.cff-shell {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 24px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 64px;
  align-items: start;
}

/* sidebar */
.cff-side {
  position: static !important;
  width: auto !important;
  font-size: 14px;
}
.cff-side h2 {
  margin: 0 0 8px;
  font: 700 20px var(--display);
  color: var(--maillot);
}
.cff-stage {
  margin-bottom: 18px;
  padding: 12px;
  background: var(--night-2);
  border-left: 4px solid var(--maillot);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.cff-stage img { display: block; width: 100%; height: auto; aspect-ratio: 13 / 8; max-height: 160px; object-fit: cover; background: var(--night-3); border-radius: 6px; margin-bottom: 8px; }
.cff-stage__name { margin: 0; font-weight: 600; }
.cff-stage__num {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  background: var(--text);
  color: var(--night);
  font: 700 14px var(--display);
  border-radius: 3px;
}
.cff-stage__tour, .cff-stage time { display: block; color: var(--muted); font-size: 13px; }
.cff-alerts { list-style: none; margin: 0 0 18px; padding: 0; }
.cff-alerts a {
  display: block;
  margin-bottom: 6px;
  padding: 10px 12px;
  background: var(--team-red);
  color: #fff;
  border: 2px solid var(--team-red);
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
}
.cff-side__links { list-style: none; margin: 18px 0 0; padding: 0; }
.cff-side__links a { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--text); }
.cff-button,
a.buttono2 {
  display: inline-block;
  width: auto !important;
  white-space: nowrap;
  padding: 8px 20px;
  margin-bottom: 18px;
  line-height: 1.2;
  background: var(--maillot);
  color: var(--maillot-ink) !important;
  border-radius: 999px;
  font: 700 17px var(--display);
  text-decoration: none;
}
.cff-button:hover { background: var(--accent-hover); }
.cff-ad { margin: 12px 0; min-height: 0; }

/* ---- legacy page content ------------------------------------------------- */
/* everything a page prints goes in the main column; the sidebar spans the rows */
.cff-shell > *:not(.cff-side) { grid-column: 2; min-width: 0; max-width: 100%; overflow-x: auto; }
.cff-side { grid-column: 1; grid-row: 1 / span 30; }

/* old pages place boxes with absolute pixel positions (#skills, #trofeos,
   Layer1...): put them back in the normal flow, side by side when they fit */
#content div[id], #content2 div[id],
.cff-shell [style*="position:absolute"], .cff-shell [style*="position: absolute"],
.cff-shell div#content2, .cff-shell div#content5 {
  position: static !important;
  left: auto !important;
  top: auto !important;
  height: auto !important;
}
#content div[id], .cff-shell [style*="position:absolute"], .cff-shell [style*="position: absolute"] {
  display: inline-block;
  vertical-align: top;
  max-width: 100%;
  margin: 0 16px 16px 0 !important;
}
#content .tip span, #content td.tooltip span { position: absolute !important; }

div#content, div#content2, div#content5 {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  width: auto !important;
  min-width: 0;
  margin: 0 !important;
  padding: 20px !important;
  background: var(--night-2) !important;
  border: 1px solid var(--rule) !important;
  border-radius: var(--radius) !important;
  font-family: var(--body) !important;
  font-size: 14px !important;
  color: var(--text);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#content h1, #content h2, #content h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; }
#content img { max-width: 100%; }
#content img:not([height]) { height: auto; }
#content input[type="text"], #content input[type="password"], #content input[type="number"],
#content input[type="email"], #content select, #content textarea,
#content2 input[type="text"], #content2 input[type="password"], #content2 input[type="number"],
#content2 input[type="email"], #content2 select, #content2 textarea {
  max-width: 100%;
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--input-ink);
  font: inherit;
}
#content input[type="submit"], #content input[type="button"], #content button,
#content2 input[type="submit"], #content2 input[type="button"], #content2 button {
  min-height: 36px;
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--maillot);
  color: var(--maillot-ink);
  font: 700 16px var(--display);
  cursor: pointer;
}

/* ---- phones and small tablets ------------------------------------------- */
@media (max-width: 899px) {
  body { font-size: 16px; }
  .cff-top { padding: 10px 14px 20px; }
  .cff-wordmark { font-size: 22px; }
  .cff-top { gap: 10px; }
  .cff-clock { font-size: 16px; }
  .cff-clock__date { display: none; }
  .cff-menu-btn { display: inline-flex; }

  .cff-nav { display: none; }
  .cff-nav.is-open { display: block; }
  .cff-nav__groups { display: block; padding: 0 0 8px; }
  .cff-nav__group summary, .cff-nav__logout a { padding: 14px 16px; border-bottom: 1px solid var(--rule); }
  .cff-nav__group ul { position: static; box-shadow: none; border: 0; border-radius: 0; background: var(--night-2); }
  .cff-nav__group li a { padding: 12px 28px; }

  .cff-shell { display: flex; flex-direction: column; align-items: stretch; padding: 12px 10px 48px; }
  .cff-shell > *:not(.cff-side) { order: 0; }
  .cff-side { order: 1; margin-top: 24px; }
  .cff-ad--side { display: none; }

  div#content { padding: 14px !important; font-size: 15px !important; }

  /* old fixed-width tables and images: fit the screen, scroll sideways if they must */
  table[width], table[style*="width"] { width: 100% !important; }
  img { max-width: 100%; }
  img:not([height]) { height: auto; }
  body > div, body > center, body > table { max-width: 100%; overflow-x: auto; }
  #content td, #content th { word-break: normal; }

  /* boxes that were placed with pixel positions: full width on phones */
  #content div[id], .cff-shell [style*="position:absolute"], .cff-shell [style*="position: absolute"] {
    display: block;
    width: auto !important;
    margin-right: 0 !important;
  }
}

/* ---- maintenance page ---------------------------------------------------- */
.cff-maintenance { max-width: 560px; margin: 12vh auto; padding: 0 20px; font-size: 18px; }
.cff-maintenance .cff-wordmark { color: var(--maillot) !important; font-size: 40px; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* ==========================================================================
   Themes
   Dark keeps the original page colours. Light and high contrast repaint the
   legacy page content (inline bgcolor/font colors, per-page <style> blocks)
   from the theme tokens so every old page follows the chosen theme.
   ========================================================================== */

/* ---- switcher ------------------------------------------------------------ */
.cff-nav__theme { margin-left: auto; display: flex; align-items: center; padding: 0 8px; }
.cff-nav__theme + .cff-nav__logout { margin-left: 0; }
.cff-theme { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--rule); border-radius: 999px; }
.cff-theme button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 600 14px var(--body);
  cursor: pointer;
}
.cff-theme button[aria-pressed="true"] { background: var(--maillot); color: var(--maillot-ink); }
.cff-theme__swatch { width: 12px; height: 12px; border-radius: 50%; border: 1px solid currentColor; }
.cff-theme__swatch--dark { background: #0a1238; }
.cff-theme__swatch--light { background: #ffffff; }
.cff-theme__swatch--contrast { background: linear-gradient(90deg, #000 50%, #ff0 50%); }

@media (max-width: 899px) {
  .cff-nav__theme { padding: 14px 16px; border-bottom: 1px solid var(--rule); }
  .cff-theme { width: 100%; justify-content: space-between; }
  .cff-theme button { flex: 1; justify-content: center; min-height: 40px; padding: 0 6px; }
}

/* ---- legacy content in light / high contrast ------------------------------ */
:root[data-theme="light"] body:not(.landing),
:root[data-theme="contrast"] body:not(.landing) { background: var(--night) !important; color: var(--text) !important; }

:root[data-theme="light"] body:not(.landing) :not(.cff-top, .cff-top *, .cff-nav, .cff-nav *, .cff-side, .cff-side *,
  .cff-button, .cff-theme *, img, svg, svg *, iframe, ins, input, select, textarea, button),
:root[data-theme="contrast"] body:not(.landing) :not(.cff-top, .cff-top *, .cff-nav, .cff-nav *, .cff-side, .cff-side *,
  .cff-button, .cff-theme *, img, svg, svg *, iframe, ins, input, select, textarea, button) {
  background-color: transparent !important;
  background-image: none !important;
  color: var(--text) !important;
  border-color: var(--rule) !important;
  text-shadow: none !important;
  box-shadow: none !important;
}
:root[data-theme="light"] body:not(.landing) a:not(.cff-button, .cff-wordmark),
:root[data-theme="contrast"] body:not(.landing) a:not(.cff-button, .cff-wordmark) { color: var(--link) !important; }
:root[data-theme="light"] .cff-shell > :not(.cff-side),
:root[data-theme="contrast"] .cff-shell > :not(.cff-side) { background-color: var(--night-2) !important; }

/* tables: header rows, striping, cell rules */
:root[data-theme="light"] body:not(.landing) tr:nth-child(even) > td,
:root[data-theme="contrast"] body:not(.landing) tr:nth-child(even) > td { background-color: var(--stripe) !important; }
:root[data-theme="light"] body:not(.landing) th,
:root[data-theme="light"] body:not(.landing) tr:first-child > td[class] {
  background-color: var(--night-3) !important;
  font-weight: 700;
}
:root[data-theme="light"] body:not(.landing) td, :root[data-theme="light"] body:not(.landing) th { border-bottom: 1px solid var(--rule); }

/* controls inside old pages */
:root[data-theme="light"] body:not(.landing) input[type="submit"], :root[data-theme="light"] body:not(.landing) input[type="button"],
:root[data-theme="light"] body:not(.landing) button:not(.cff-theme button, .cff-menu-btn),
:root[data-theme="contrast"] body:not(.landing) input[type="submit"], :root[data-theme="contrast"] body:not(.landing) input[type="button"],
:root[data-theme="contrast"] body:not(.landing) button:not(.cff-theme button, .cff-menu-btn) {
  background: var(--maillot) !important;
  color: var(--maillot-ink) !important;
  border: 2px solid var(--maillot) !important;
}
:root[data-theme="light"] body:not(.landing) input:not([type="submit"], [type="button"], [type="image"], [type="checkbox"], [type="radio"]),
:root[data-theme="light"] body:not(.landing) select, :root[data-theme="light"] body:not(.landing) textarea,
:root[data-theme="contrast"] body:not(.landing) input:not([type="submit"], [type="button"], [type="image"], [type="checkbox"], [type="radio"]),
:root[data-theme="contrast"] body:not(.landing) select, :root[data-theme="contrast"] body:not(.landing) textarea {
  background: var(--input-bg) !important;
  color: var(--input-ink) !important;
  border: 2px solid var(--rule) !important;
}
/* old pill-style links (class buttono / buttono2 / buttonox) */
:root[data-theme="light"] body:not(.landing) a[class^="buttono"], :root[data-theme="contrast"] body:not(.landing) a[class^="buttono"] {
  display: inline-block;
  padding: 4px 12px;
  border: 2px solid var(--link) !important;
  border-radius: 999px;
}

/* ---- high contrast extras ------------------------------------------------- */
:root[data-theme="contrast"] .cff-top { border-bottom: 3px solid #fff; }
:root[data-theme="contrast"] .cff-profile { fill: #000; stroke: #fff; stroke-width: 2; }
:root[data-theme="contrast"] body a:not(.cff-wordmark) { text-decoration: underline !important; text-underline-offset: 2px; }
:root[data-theme="contrast"] .cff-alerts a { border-color: #fff; }
:root[data-theme="contrast"] .cff-stage,
:root[data-theme="contrast"] div#content,
:root[data-theme="contrast"] .cff-nav__group ul { border: 2px solid #fff !important; }
:root[data-theme="contrast"] body td, :root[data-theme="contrast"] body th { border: 1px solid #fff !important; }
:root[data-theme="contrast"] :focus-visible { outline: 3px solid var(--focus) !important; outline-offset: 3px; }

/* ---- light extras ---------------------------------------------------------- */
:root[data-theme="light"] .cff-nav { background: #fff; }
:root[data-theme="light"] .cff-side h2 { color: var(--team-red); }
:root[data-theme="light"] .cff-stage { border-left-color: var(--team-red); }
:root[data-theme="light"] .cff-stage__num { background: var(--text); color: #fff; }
:root[data-theme="light"] .landing__title { color: var(--text); }

/* ---- squad page (plantilla.php) ------------------------------------------ */
#content .cff-squad-title { margin: 0 0 10px; font-size: 24px; color: var(--maillot); }
.cff-squad-extra { margin: 18px 0; font-size: 14px; line-height: 1.6; }
.cff-squad-extra select { margin: 6px 0; }
.cff-squad-ad { margin: 12px 0; max-width: 100%; overflow: hidden; }
.cff-squad-note { margin: 18px 0; color: var(--maillot); font-weight: 600; }

/* ---- pages whose boxes sat side by side with absolute positions ---------- */
.cff-cols { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px 24px; }
.cff-cols > * { min-width: 0; max-width: 100%; }
.cff-cols > div[id] { margin: 0 !important; }
.cff-cols__main { flex: 1 1 380px; max-width: 640px; min-width: 0; overflow-x: auto; }
.cff-cols__main table[width] { width: 100% !important; max-width: 100%; }
.cff-cols > #twitter2 { flex: 0 1 280px; }
.cff-cols > #twitter2 table { width: 100% !important; }
.cff-cols > #twitter { flex: 0 1 260px; }
.cff-cols__side, .cff-cols > div[id] { flex: 0 1 auto; }
@media (max-width: 700px) { .cff-cols > * { flex: 1 1 100%; } }

/* team page sub-menu (.menuu2_div / .menuu_div): was pinned at a fixed spot
   by cyclingmanager.css; now a row of links at the top of the content */
.cff-shell .menuu2_div ul, .cff-shell .menuu_div ul {
  position: static !important;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: auto !important;
  margin: 0 0 16px !important;
  padding: 0 !important;
  text-indent: 0 !important;
  font: 600 14px var(--body) !important;
}
.cff-shell .menuu2_div ul li, .cff-shell .menuu_div ul li {
  background: var(--night-3) !important;
  border: 1px solid var(--rule) !important;
  border-radius: 999px;
  line-height: 1.2 !important;
}
.cff-shell .menuu2_div ul li a, .cff-shell .menuu_div ul li a { padding: 6px 12px; color: var(--text) !important; border-radius: 999px; }
.cff-shell .menuu2_div ul li a:hover, .cff-shell .menuu_div ul li a:hover { background: var(--maillot) !important; color: var(--maillot-ink) !important; }

/* section tabs on race pages (Tramo 1..5: a.buttono, current one a.buttonox).
   The old gradient background no longer renders, so draw them as pills. */
.cff-shell a.buttono, .cff-shell a.buttonox {
  display: inline-block;
  width: auto !important;
  min-width: 96px;
  margin: 0 6px 8px 0;
  padding: 6px 14px !important;
  border: 2px solid var(--team-red) !important;
  border-radius: 999px !important;
  background: var(--team-red) !important;
  box-shadow: none !important;
  color: #fff !important;
  font: 700 15px/1.2 var(--display) !important;
  text-align: center;
  text-shadow: none !important;
  text-decoration: none;
}
.cff-shell a.buttono:hover { border-color: var(--maillot) !important; }
.cff-shell a.buttonox { background: var(--maillot) !important; border-color: var(--maillot) !important; color: var(--maillot-ink) !important; }
.cff-tabs { display: flex; flex-wrap: wrap; margin: 8px 0 12px; }

/* ---- rider page (vision.php) --------------------------------------------- */
.rider-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin: 0 0 18px;
  padding: 18px 20px;
  background: var(--night-3);
  border: 1px solid var(--rule);
  border-left: 6px solid var(--maillot);
  border-radius: var(--radius);
}
#content2 .rider-hero div[id], #content .rider-hero div[id] {
  display: block; width: auto !important; margin: 0 !important; padding: 0;
}
.rider-hero #logo:empty { display: none !important; }
.rider-hero #logo img { width: 72px; height: 72px; object-fit: contain; }
.rider-hero #bandera img { width: 44px; height: 33px; border-radius: 4px; box-shadow: 0 0 0 1px var(--rule); }
.rider-hero #namecab { flex: 1 1 260px; }
.rider-hero #namecab p { margin: 0 !important; text-align: left !important; }
.rider-hero #namecab br { display: none; }
.rider-hero h22 {
  display: block;
  font: 800 italic 34px/1.05 var(--display) !important;
  letter-spacing: 0 !important;
  color: var(--text) !important;
}
.rider-hero #namecab h3 { margin: 4px 0 0; font: 700 20px var(--display); }
.rider-hero #namecab h3 a { color: var(--maillot) !important; }
.rider-hero #iconos { display: flex !important; flex-wrap: wrap; align-items: center; gap: 6px; }
.rider-hero #iconos img { width: 34px; height: 34px; object-fit: contain; }
.rider-hero__side { display: flex !important; flex-wrap: wrap; align-items: center; gap: 10px; margin-left: auto !important; }
.rider-hero__side > a img { width: 30px; height: 30px; }
.rider-hero__side > br { display: none; }
.rider-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.rider-chips > div { min-width: 82px; padding: 6px 12px; background: var(--night-2); border: 1px solid var(--rule); border-radius: 10px; }
.rider-chips dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.rider-chips dd { margin: 0; font: 700 22px/1.1 var(--display); color: var(--text); }

.rider-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 18px; }
.rider-actions:empty { display: none; }
.rider-action {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 200px; padding: 12px 14px;
  background: var(--night-3); border: 1px solid var(--rule); border-radius: var(--radius);
  font-weight: 600;
}
.rider-action br { display: none; }
.rider-action form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.rider-action input[type="text"] { width: 140px !important; }
.rider-action input[type="submit"] {
  padding: 6px 16px; border: 0; border-radius: 999px;
  background: var(--maillot); color: var(--maillot-ink); font: 700 15px var(--display); cursor: pointer;
}
.rider-action p { margin: 4px 0; text-align: left !important; }

.rider-grid { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; }
.rider-grid > div[id] {
  margin: 0 !important; padding: 16px !important;
  background: var(--night-3); border: 1px solid var(--rule) !important; border-radius: var(--radius) !important;
}
.rider-grid table[width] { max-width: 100%; }
@media (max-width: 700px) {
  .rider-hero h22 { font-size: 28px !important; }
  .rider-hero__side { margin-left: 0 !important; }
  .rider-action, .rider-grid > div[id] { flex: 1 1 100%; }
}
.rider-hero #namecab h3, .rider-hero #namecab h3 * { background: transparent !important; }
.rider-grid #trofeos { order: -1; }
.rider-grid #trofeos table { font-size: 14px !important; }
.rider-grid #resultados table { font-size: 14px !important; }
.rider-grid td { padding: 3px 6px; }
.rider-grid #trofeos td.fondo, .rider-grid #resultados td.fondo { font-size: 13px; }

/* ad slots in old pages are inline-block: links printed next to them (race
   section tabs, buttons) wrapped around the ad. Give every ad its own row. */
.cff-shell ins.adsbygoogle { display: block !important; max-width: 100%; margin: 12px 0; }

/* rider skills as bars */
.rider-skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; min-width: min(420px, 100%); }
.rider-skill { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 8px; }
.rider-skill span { color: var(--muted); font-size: 14px; }
.rider-skill b { font: 700 20px/1 var(--display); color: var(--text); }
.rider-skill i, .rider-meter i {
  grid-column: 1 / -1; display: block; height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, var(--bar) var(--v), var(--night-2) var(--v));
  box-shadow: inset 0 0 0 1px var(--rule);
}
.rider-skill { --bar: #6c7aa8; }
.rider-skill--t1 { --bar: #4f9d69; }
.rider-skill--t2 { --bar: #8fbf3f; }
.rider-skill--t3 { --bar: #f2c230; }
.rider-skill--t4 { --bar: #f08a24; }
.rider-skill--t5 { --bar: #e5383b; }
.rider-skill--t4 b, .rider-skill--t5 b { color: var(--maillot); }
.rider-condition { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule); }
.rider-meter { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; }
.rider-meter span { color: var(--muted); font-size: 14px; }
.rider-meter b { font: 700 18px/1 var(--display); }
.rider-meter i { height: 10px; }
.rider-meter--good { --bar: #2fa36b; }
.rider-meter--ok { --bar: #f2c230; }
.rider-meter--low { --bar: #e5383b; }
.rider-copy { margin: 12px 0 0; font-size: 13px; text-align: right; }
:root[data-theme="contrast"] .rider-skill i, :root[data-theme="contrast"] .rider-meter i { box-shadow: inset 0 0 0 1px #fff; }
@media (max-width: 480px) { .rider-skills { grid-template-columns: 1fr 1fr; gap: 8px 12px; } }

/* rider page: old section headings (h1/h4 bars) as clean card headings */
.rider-grid h1, .rider-grid h4 {
  margin: 18px 0 10px !important; padding: 0 0 6px !important;
  background: none !important; border: 0; border-bottom: 1px solid var(--rule) !important;
  color: var(--maillot) !important; font: 700 20px/1.1 var(--display) !important; text-align: left !important;
}
.rider-grid > div[id] > h1:first-child, .rider-grid > div[id] > table:first-child h4 { margin-top: 0 !important; }
.rider-grid h1 p, .rider-grid h4 p { margin: 0; text-align: left !important; }
.rider-grid h3 { margin: 4px 0; background: none !important; color: var(--text) !important; font: 700 17px var(--display) !important; }
.rider-grid table, .rider-grid td { background: transparent !important; }
.rider-grid table[width] { width: 100% !important; }
.rider-grid td.fondo {
  background: var(--night-2) !important; color: var(--muted) !important;
  border-radius: 8px; font: 600 13px var(--body) !important; padding: 6px 4px;
}
.rider-grid #resultados { flex: 1 1 280px; max-width: 420px; }
.rider-grid #trofeos { flex: 1 1 440px; }
.rider-grid td { font-size: 14px; line-height: 1.4; }

/* ==== data tables (all themes) ==============================================
   The old pages colour every cell (fondo* = red/grey header cells, tabla* /
   subra rows = navy with 9-10px text, per-page <style> blocks too). Any table
   with a header row (td.fondo* or th) now gets one calm style: header row,
   readable rows, zebra, hover, and a tint only where the colour meant something
   (own team, promotion, relegation, skill tiers). Clicking a header sorts
   (js/sortable-tables.js). */
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) {
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  border: 0 !important;
}
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > * > tr { background: transparent !important; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > * > tr > :is(td[class^="fondo"], th) {
  padding: 8px 10px !important;
  background: var(--night-3) !important;
  color: var(--muted) !important;
  border: 0 !important;
  border-bottom: 2px solid var(--rule) !important;
  font: 700 13px/1.25 var(--body) !important;
  text-align: center;
  white-space: nowrap;
}
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > * > tr > :is(td[class^="fondo"], th) a { color: var(--text) !important; text-decoration: underline dotted; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr > td:not([class^="fondo"]) {
  padding: 7px 10px !important;
  background: transparent !important;
  color: var(--text) !important;
  border: 0 !important;
  border-bottom: 1px solid var(--rule) !important;
  font: 400 14px/1.35 var(--body) !important;
}
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr > td:not([class^="fondo"]) font { font-size: inherit !important; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr:nth-child(even) > td:not([class^="fondo"]) { background: var(--stripe) !important; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr:hover > td:not([class^="fondo"]) { background: var(--night-3) !important; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr > td:not([class^="fondo"]) a { color: var(--link, var(--maillot)) !important; }

/* colours that carried meaning */
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr > td:not([class^="fondo"]):is(.tabla41, .tabla8, .tabla12, .tabla15, .fondo3) { background: color-mix(in srgb, var(--maillot) 22%, transparent) !important; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr > td:not([class^="fondo"]):is(.tabla4, .tablax2) { background: color-mix(in srgb, #2fa36b 26%, transparent) !important; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr > td:not([class^="fondo"]):is(.tabla5, .tabla13, .tabla14, .tablann3, .tablan, .tabla27, .tabla28) { background: color-mix(in srgb, #e5383b 24%, transparent) !important; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr > td:not([class^="fondo"]).tablar { color: #e5383b !important; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr > td:not([class^="fondo"]).tabla51 { color: #8fbf3f !important; font-weight: 600 !important; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr > td:not([class^="fondo"]).tabla52 { color: #c9a227 !important; font-weight: 600 !important; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr > td:not([class^="fondo"]).tabla53 { color: #e09a1e !important; font-weight: 700 !important; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr > td:not([class^="fondo"]).tabla54 { color: #e8742a !important; font-weight: 700 !important; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr > td:not([class^="fondo"]).tabla55 { color: #e5383b !important; font-weight: 800 !important; }

html:root body:not(.landing) .cff-shell table.cff-sortable > tbody > tr > td:nth-child(-n+2) { white-space: nowrap; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr > td img { vertical-align: middle; }

/* sortable headers */
.cff-sortable td.cff-sort, .cff-sortable th.cff-sort { cursor: pointer; user-select: none; }
.cff-sortable .cff-sort::after { content: " \2195"; opacity: .45; font-size: .9em; }
.cff-sortable .cff-sort[aria-sort="ascending"]::after { content: " \25B2"; opacity: 1; }
.cff-sortable .cff-sort[aria-sort="descending"]::after { content: " \25BC"; opacity: 1; }
html:root body:not(.landing) .cff-shell .cff-sortable .cff-sort:hover,
html:root body:not(.landing) .cff-shell .cff-sortable .cff-sort[aria-sort$="ending"] { color: var(--text) !important; }
.cff-sortable .cff-sort:focus-visible { outline: 2px solid var(--maillot); outline-offset: -2px; }
.admin .table th.cff-sort:hover { color: var(--text); }

/* ---- icons ------------------------------------------------------------------
   Most game icons (medals, specialists, weather, cards) are JPG/GIF drawn on a
   navy square. "lighten" lets the panel colour show through that square in
   every theme (navy is darker than any of our panels) while the icon keeps its
   colours; a small radius and a touch of softness take off the hard edge. */
.cff-shell img[src*="imagenes/"]:not([src$=".png"]),
.cff-side img[src*="imagenes/"]:not([src$=".png"]) {
  mix-blend-mode: lighten;
  border-radius: 6px;
  filter: saturate(1.05) brightness(1.08);
}
/* on the light theme "lighten" would wash the icons out: keep them as soft tiles */
:root[data-theme="light"] .cff-shell img[src*="imagenes/"]:not([src$=".png"]),
:root[data-theme="light"] .cff-side img[src*="imagenes/"]:not([src$=".png"]) {
  mix-blend-mode: normal; filter: brightness(1.35) saturate(1.1); box-shadow: 0 1px 2px rgba(10, 18, 56, .25);
}
/* keep the rider bars in light / high contrast (the legacy repaint clears backgrounds) */
html:root body:not(.landing) .cff-shell .rider-skill i,
html:root body:not(.landing) .cff-shell .rider-meter i {
  background: linear-gradient(90deg, var(--bar) var(--v), var(--night-3) var(--v)) !important;
}
html:root body:not(.landing) .cff-shell .rider-chips > div,
html:root body:not(.landing) .cff-shell .rider-action,
html:root body:not(.landing) .cff-shell .rider-hero { background: var(--night-3) !important; }
:root[data-theme="light"] .rider-hero #namecab h3 a { color: var(--link) !important; }

/* data tables fill the card and shrink instead of scrolling: header labels may
   wrap, and tables with many columns get tighter cells */
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) { width: 100% !important; max-width: 100%; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > * > tr > :is(td[class^="fondo"], th) { white-space: normal; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th):has(> tbody > tr > :nth-child(9)) > * > tr > td { padding: 6px 5px !important; font-size: 13px !important; }
.cff-ad { clear: both; }
.cff-ad ins.adsbygoogle { overflow: hidden; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th):has(> tbody > tr > :nth-child(13)) > * > tr > td { padding: 5px 3px !important; font-size: 12px !important; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th):has(> tbody > tr > :nth-child(13)) > * > tr > :is(td[class^="fondo"], th) { font-size: 11.5px !important; letter-spacing: 0; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th):has(> tbody > tr > :nth-child(13)) select { max-width: 110px; min-height: 28px !important; padding: 2px 4px !important; font-size: 12px !important; }
.cff-sortable .cff-sort::after { white-space: nowrap; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th):has(> tbody > tr > :nth-child(13)) > * > tr > :is(td[class^="fondo"], th) { hyphens: auto; -webkit-hyphens: auto; }
html:root body:not(.landing) .cff-shell table.cff-sortable:has(> tbody > tr > :nth-child(13)) > tbody > tr > td:nth-child(-n+2) { white-space: normal; }
#content table[width], #content2 table[width] { max-width: 100%; }

/* ---- team page (team.php) ------------------------------------------------- */
.team-hero h22 a { color: var(--text) !important; text-decoration: none; }
.team-hero #bandera { display: flex !important; flex-direction: column; align-items: center; gap: 8px; }
.team-hero #bandera br { display: none; }
.team-hero #namecab p { margin: 2px 0 !important; }
.team-hero .team-level { display: grid; max-width: 280px; margin-top: 8px; text-decoration: none; color: var(--text); }
.team-hero .team-level span { color: var(--muted); font-size: 13px; }
.team-hero .rider-hero__side { flex-direction: column; align-items: flex-end; }
.team-chips dd a { color: var(--text) !important; text-decoration: none; }
.team-chips dd a:hover { color: var(--maillot) !important; }
.team-meta { margin: 0; color: var(--muted); font-size: 13px; text-align: right; }
.team-meta a { color: var(--maillot); }
/* supporter extras printed inside the team menu (best times, prestige, favourite stages) */
.cff-shell .menuu2_div ul li:has(table) {
  flex: 1 1 100%; border-radius: var(--radius) !important; padding: 10px 12px;
}
.cff-shell .menuu2_div ul > table, .cff-shell .menuu2_div ul li table { width: auto !important; }
@media (max-width: 700px) {
  .team-hero .rider-hero__side { align-items: flex-start; }
  .team-meta { text-align: left; }
}
.rider-grid > div[id] { min-width: 0; } .rider-grid table { max-width: 100% !important; table-layout: auto; } .rider-grid #resultados table td { padding-left: 2px !important; padding-right: 2px !important; }

/* phones: data tables keep their rows on one line and scroll sideways inside the card */
@media (max-width: 700px) {
  html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) { display: block; width: auto !important; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > * > tr > td { white-space: nowrap !important; }
}

/* theme switcher in the red top bar, left of the clock (desktop); on phones it
   stays in the menu drawer where there is room for it */
.cff-top__theme { margin-left: auto; display: flex; }
.cff-top__theme + .cff-clock { margin-left: 0; }
.cff-top .cff-theme { border-color: rgba(255, 255, 255, .35); background: rgba(0, 0, 0, .12); }
.cff-top .cff-theme button { color: var(--bar-ink); }
.cff-top .cff-theme button[aria-pressed="true"] { background: var(--maillot); color: var(--maillot-ink); }
.cff-nav__theme { display: none !important; }
.cff-nav__logout { margin-left: auto !important; }
@media (max-width: 899px) {
  .cff-top__theme { display: none; }
  .cff-top__theme + .cff-clock { margin-left: auto; }
  .cff-nav__theme { display: flex !important; }
}
:root[data-theme="contrast"] .cff-top .cff-theme { border-color: #fff; background: #000; }
.team-chips .team-chip--supporter { border-color: var(--maillot) !important; }
.team-chips .team-chip--supporter dt { color: var(--maillot); }
.team-admin { margin: 6px 0 0; text-align: right; }
.team-admin .cff-button { margin: 0; padding: 6px 14px; font-size: 15px; }
.team-extras { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 24px; margin: 0 0 18px; padding: 14px 16px; background: var(--night-3); border: 1px solid var(--rule); border-radius: var(--radius); }
.team-extras .team-extra__title { flex: 1 1 100%; margin: 6px 0 0; font: 700 17px var(--display); color: var(--maillot); }
.team-extras .team-extra__title a { color: var(--maillot) !important; }
.team-extras table { width: auto !important; }
.team-extras table img[src*="etapas/"] { border-radius: 6px; }
html:root body:not(.landing) .cff-shell .team-extras .team-extra__title { background: none !important; padding: 0 !important; border-bottom: 1px solid var(--rule); }
html:root body:not(.landing) .cff-shell .team-extras td { background: transparent !important; font: 400 14px/1.4 var(--body) !important; padding: 3px 8px !important; }

/* ---- calendars (newcalendar.php, totalcalendar2.php): one card per stage -- */
.cff-shell table.cff-cal, .cff-shell table.cff-cal > tbody { display: block; width: 100% !important; }
.cff-shell table.cff-cal tr.cff-cal__head { display: none; }
.cff-shell table.cff-cal > tbody > tr {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  margin: 0 0 12px; padding: 14px 18px;
  background: var(--night-3); border: 1px solid var(--rule); border-radius: var(--radius);
}
.cff-shell table.cff-cal > tbody > tr > td { display: block; padding: 0 !important; border: 0 !important; background: none !important; }
.cff-shell table.cff-cal > tbody > tr > td:first-child { flex: 0 0 44px; text-align: center; }
.cff-shell table.cff-cal > tbody > tr > td:first-child font { font: 800 italic 30px/1 var(--display) !important; color: var(--maillot) !important; }
.cff-shell table.cff-cal > tbody > tr > td:nth-child(2) { flex: 1 1 220px; min-width: 0; }
.cff-shell table.cff-cal h3 { margin: 0 0 2px; font: 700 20px/1.15 var(--display) !important; color: var(--text) !important; background: none !important; }
.cff-shell table.cff-cal td:nth-child(2) strong { color: var(--muted); font-weight: 600; }
.cff-shell table.cff-cal td:nth-child(2) br + br { display: none; }
.cff-shell table.cff-cal h1 { margin: 10px 0 4px; font: 700 15px var(--display) !important; color: var(--maillot) !important; background: none !important; }
.cff-shell table.cff-cal img[src*="etapas/"] { display: block; width: 280px; max-width: 100%; height: auto; border-radius: 8px; }
.cff-shell table.cff-cal > tbody > tr > td:nth-child(3) { flex: 0 1 280px; color: var(--muted); font-size: 13px; text-align: center; }
.cff-cal__riders { flex: 1 1 180px; }
.cff-cal__riders ul { margin: 0; padding: 0; list-style: none; columns: 1; }
.cff-cal__riders li { padding: 3px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.cff-cal__riders li:last-child { border-bottom: 0; }
.cff-cal__riders:not(:has(li)) { display: none !important; }
.cff-shell table.cff-cal > tbody > tr > td:last-child:not(:nth-child(3)) { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.cff-shell table.cff-cal form { margin: 0; }
.cff-shell table.cff-cal td:last-child br { display: none; }
.cff-shell table.cff-cal input.buttono { width: 100%; }
@media (max-width: 700px) {
  .cff-shell table.cff-cal > tbody > tr > td:nth-child(3) { flex: 1 1 100%; }
  .cff-shell table.cff-cal img[src*="etapas/"] { width: 100%; }
  .cff-shell table.cff-cal > tbody > tr > td:last-child:not(:nth-child(3)) { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; }
}
/* calendar cards as a grid so the columns line up from card to card */
@media (min-width: 701px) {
  .cff-shell table.cff-cal > tbody > tr { display: grid; grid-template-columns: 44px minmax(0, 1fr) 280px; }
  .cff-shell table.cff-cal:has(.cff-cal__riders) > tbody > tr { grid-template-columns: 44px minmax(0, 1fr) 280px minmax(140px, 200px) 150px; }
  .cff-shell table.cff-cal:has(.cff-cal__riders) > tbody > tr > td:nth-child(3):last-child { grid-column: 3 / -1; }
  .cff-cal__riders:not(:has(li)) { display: block !important; visibility: hidden; }
}
.cff-shell table.cff-cal > tbody > tr > td:nth-child(2), .cff-shell table.cff-cal > tbody > tr > td:nth-child(2) * { text-align: left !important; }
.cff-shell table.cff-cal > tbody > tr > td:nth-child(2) p { margin: 0; }
/* status pages: both columns share the row (the squad box used to take its
   table's full width and drop under the info column) */
.cff-cols > .cff-cols__main { flex: 1 1 280px; max-width: 600px; }
.cff-cols > .cff-cols__side { flex: 1 1 300px; min-width: 0; }
.cff-cols > .cff-cols__side table { width: 100% !important; }

/* icons with width/height attributes inside table cells were squeezed by
   max-width:100% (thin, stretched); keep their size and aspect ratio */
#content td img[width][height], #content2 td img[width][height], #content5 td img[width][height],
.cff-shell td img[width][height] { max-width: none; object-fit: contain; }
img[width][height] { object-fit: contain; }

/* dropdown lists: the dark colour scheme paints the open list dark, while the
   options inherited the select's dark ink (invisible). Give options the input
   colours in every theme, on every page. */
select option, select optgroup { background-color: var(--input-bg) !important; color: var(--input-ink) !important; }
select { color: var(--input-ink); background-color: var(--input-bg); }

/* dropdowns inside data tables (race tactics, strategies) fit their column */
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) select { max-width: 128px; min-height: 32px !important; padding: 2px 6px !important; font-size: 13px !important; }

/* ---- transfer market (bucca.php) ----------------------------------------- */
.market { display: grid; grid-template-columns: minmax(200px, 240px) minmax(0, 1fr); gap: 20px; align-items: start; }
.market > div[id] { display: block !important; width: auto !important; margin: 0 !important; min-width: 0; }
.market > #iconos2 { grid-row: span 3; display: grid !important; gap: 14px; }
.market > #iconos2 > table:first-child { width: 100% !important; border-collapse: separate; border-spacing: 0 8px; }
.market > #iconos2 > table:first-child td { padding: 0; text-align: left !important; }
.market > #iconos2 > table:first-child a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--night-3); border: 1px solid var(--rule); border-radius: var(--radius);
  color: var(--text) !important; font-weight: 600; text-decoration: none;
}
.market > #iconos2 > table:first-child a:hover { border-color: var(--maillot); }
.market > #iconos2 > table:first-child a br { display: none; }
.market > #iconos2 > table:first-child a img { order: -1; width: 34px; height: 34px; object-fit: contain; border-radius: 6px; }
.market > #iconos2 table + table, .market > #iconos2 > table:not(:first-child) { width: 100% !important; }
.market-search { padding: 18px 20px !important; background: var(--night-3); border: 1px solid var(--rule) !important; border-radius: var(--radius) !important; }
.market-search center { display: none; }
.market-form h2 { margin: 0 0 12px; font: 800 italic 28px/1 var(--display); color: var(--text); }
.market-form fieldset { margin: 0 0 14px; padding: 0; border: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 18px; }
.market-form legend { margin-bottom: 8px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.market-range, .market-field { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 6px; }
.market-field { grid-template-columns: 1fr minmax(0, 170px); }
.market-range span, .market-field span { font-weight: 600; color: var(--text); }
.market-range i { color: var(--muted); font-style: normal; }
#content2 .market-range input { width: 68px; min-height: 36px; text-align: center; }
#content2 .market-field input, #content2 .market-field select { width: 100%; min-height: 36px; }
.market-actions { display: flex; gap: 10px; align-items: center; }
.market-reset { background: transparent !important; color: var(--text) !important; border: 2px solid var(--rule) !important; }
.market > #pujas { grid-column: 2; }
@media (max-width: 800px) {
  .market { grid-template-columns: 1fr; }
  .market > #iconos2 { grid-row: auto; }
  .market > #pujas { grid-column: auto; }
}
.market > #iconos2 > table:first-child a { font-size: 15px !important; } .market > #iconos2 > table:first-child a font { font-size: inherit !important; }

/* old pages use <h1> as a 12px black-on-white bar; make it a real title */
.cff-shell h1 {
  margin: 4px 0 12px; padding: 0;
  background: none !important; color: var(--text) !important;
  font: 800 italic 26px/1.15 var(--display) !important; text-align: inherit;
}

/* ---- World Challenge (desafiando2.php / desafiando4.php) ------------------ */
.fio-hero {
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px 24px;
  margin: 0 0 18px; padding: 16px 18px;
  background: var(--night-3); border: 1px solid var(--rule); border-left: 6px solid var(--maillot); border-radius: var(--radius);
}
.fio-hero__photo { width: 320px; max-width: 100%; height: auto; border-radius: 8px; }
.fio-hero__info { flex: 1 1 260px; display: grid; gap: 10px; justify-items: start; }
.fio-hero__info h1 { margin: 0 !important; font-size: 32px !important; }
.fio-hero__tour { margin: -6px 0 0; color: var(--muted); font-weight: 600; }
.fio-hero .rider-chips dd { display: flex; align-items: center; gap: 4px; }
.fio-hero form { margin: 0; }
.fio-run { margin: 0 !important; border: 0; cursor: pointer; font-size: 19px !important; padding: 10px 26px !important; }
/* results page: the yellow-bordered boxes of the old layout */
#content #fotop2 { padding: 12px !important; background: var(--night-3); border: 1px solid var(--rule) !important; border-radius: var(--radius) !important; }
#content span.gold, #content .gold { display: inline-block; padding: 3px 12px; border-radius: 999px; background: var(--team-red); color: #fff; font-weight: 700; font-size: 13px; }
/* challenge results: one card per team, side by side */
#content td:has(> #fotop2) { display: flex; flex-wrap: wrap; gap: 12px; align-content: flex-start; }
#content #fotop2 table { width: 100% !important; }
#content #fotop2 h3 { margin: 6px 0; text-align: center; }
/* skill bars (bar.php) with their value as text */
.skill-bar { display: inline-flex; align-items: center; gap: 8px; }
.skill-bar b { min-width: 2ch; font: 700 15px var(--display); color: var(--maillot); }
:root[data-theme="light"] .skill-bar b { color: var(--link); }

/* tactics / strategy grids (a row of dropdowns per rider): share the card
   width equally instead of growing with the longest option ("Very Aggressive") */
.cff-shell table:has(> tbody > tr > td:nth-child(5) select) { width: 100% !important; max-width: 100%; table-layout: fixed; }
.cff-shell table:has(> tbody > tr > td:nth-child(5) select) > tbody > tr > td { padding-left: 4px !important; padding-right: 4px !important; overflow: hidden; }
.cff-shell table:has(> tbody > tr > td:nth-child(5) select) select { width: 100% !important; max-width: 100% !important; min-width: 0; text-overflow: ellipsis; }
.cff-shell table:has(> tbody > tr > td:nth-child(5) select) select { font-size: 13px !important; padding: 2px 2px 2px 6px !important; }
.cff-shell table:has(> tbody > tr > td:nth-child(5) select) > tbody > tr > td:last-child:empty { width: 0; }
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td:nth-child(5) select) select {
  width: 100% !important; max-width: 100% !important; font-size: 13px !important; padding: 2px 0 2px 6px !important;
}
html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td:nth-child(5) select) > tbody > tr > td:first-child { width: 12%; }

/* Tactics grids on phones (js/sortable-tables.js marks them .cff-tactics):
   one card per rider, every dropdown full width under its column title */
@media (max-width: 700px) {
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics,
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics > tbody { display: block !important; width: 100% !important; min-width: 0 !important; max-width: 100% !important; border: 0 !important; }
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics > tbody > tr.cff-tactics__head { display: none !important; }
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics > tbody > tr.cff-tactics__row.cff-tactics__row {
    display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px 10px; align-items: end;
    margin: 0 0 12px; padding: 12px; border: 1px solid var(--rule); border-radius: var(--radius);
    background: var(--night-3) !important;
  }
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics > tbody > tr.cff-tactics__row.cff-tactics__row > td {
    display: block !important; width: auto !important; padding: 0 !important; border: 0 !important;
    background: none !important; text-align: left !important; overflow: visible !important; order: 3;
  }
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics > tbody > tr.cff-tactics__row.cff-tactics__row > td br { display: none; }
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics > tbody > tr.cff-tactics__row.cff-tactics__row > td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 3px; font: 600 12px/1.2 var(--body);
    letter-spacing: .03em; text-transform: uppercase; color: var(--muted);
  }
  /* rider name across the top, effort counter next to it */
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics > tbody > tr.cff-tactics__row.cff-tactics__row > td.cff-tactics__name {
    order: 1; grid-column: 1; align-self: center; font: 700 17px/1.2 var(--display); color: var(--text) !important;
  }
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics > tbody > tr.cff-tactics__row.cff-tactics__row > td.cff-tactics__name::before { display: none; }
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics > tbody > tr.cff-tactics__row.cff-tactics__row > td.cff-tactics__info { order: 2; justify-self: end; align-self: center; text-align: right !important; }
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics > tbody > tr.cff-tactics__row.cff-tactics__row > td.cff-tactics__info:empty { display: none !important; }
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics > tbody > tr.cff-tactics__row.cff-tactics__row > td.cff-tactics__info > div {
    display: inline-block; min-width: 3.5em; padding: 2px 8px; border-radius: 999px; color: #fff; font-weight: 700; text-align: center;
  }
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics > tbody > tr.cff-tactics__row.cff-tactics__row select {
    width: 100% !important; max-width: 100% !important; min-height: 40px; font-size: 15px !important;
    padding: 6px 8px !important; text-overflow: clip;
  }
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics form { margin: 0; }
}
/* old fixed-size ad units (468x60, 728x90) never wider than the screen */
.cff-shell ins.adsbygoogle { max-width: 100% !important; overflow: hidden; }
@media (max-width: 700px) {
  html:root body:not(.landing) .cff-shell table.cff-tactics.cff-tactics > tbody > tr.cff-tactics__row.cff-tactics__row > td.cff-tactics__info::before { display: inline; margin: 0 6px 0 0; }
}
/* desktop: give the dropdowns the room of the narrow effort column */
@media (min-width: 701px) {
  html:root body:not(.landing) .cff-shell table.cff-tactics > tbody > tr.cff-tactics__head > td:last-child:not(:nth-child(-n+5)) { width: 74px; }
}

/* Division standings: promotion (green) and relegation (red) places, from divisiones.suben/bajan */
:root { --zone-up: rgba(46, 204, 113, .28); --zone-up-edge: #2ecc71; --zone-down: rgba(231, 76, 60, .30); --zone-down-edge: #e74c3c; }
:root[data-theme="light"] { --zone-up: #dff5e7; --zone-up-edge: #1e8e4e; --zone-down: #fbe1de; --zone-down-edge: #c0392b; }
html:root body:not(.landing) :is(#content, .cff-shell) table tr.cff-zone--up > td { background: var(--zone-up) !important; }
html:root body:not(.landing) :is(#content, .cff-shell) table tr.cff-zone--down > td { background: var(--zone-down) !important; }
html:root body:not(.landing) :is(#content, .cff-shell) table tr.cff-zone--up > td:first-child { box-shadow: inset 4px 0 0 var(--zone-up-edge); }
html:root body:not(.landing) :is(#content, .cff-shell) table tr.cff-zone--down > td:first-child { box-shadow: inset 4px 0 0 var(--zone-down-edge); }
:root[data-theme="contrast"] body:not(.landing) table tr.cff-zone--up > td:first-child::after { content: " ▲"; }
:root[data-theme="contrast"] body:not(.landing) table tr.cff-zone--down > td:first-child::after { content: " ▼"; }
.cff-zone-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin: 8px 0 12px; font-size: 14px; color: var(--muted); }
.cff-zone-key { display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; border-radius: 3px; }
.cff-zone-key--up { background: var(--zone-up-edge); }
.cff-zone-key--down { background: var(--zone-down-edge); }
.team-chips .team-chip--up { box-shadow: inset 0 -3px 0 var(--zone-up-edge); }
.team-chips .team-chip--down { box-shadow: inset 0 -3px 0 var(--zone-down-edge); }

/* Phones: stacked layout tables (js/sortable-tables.js adds .cff-stack) */
@media (max-width: 700px) {
  html:root body:not(.landing) .cff-shell table.cff-stack,
  html:root body:not(.landing) .cff-shell table.cff-stack > tbody,
  html:root body:not(.landing) .cff-shell table.cff-stack > tbody > tr,
  html:root body:not(.landing) .cff-shell table.cff-stack > tbody > tr > td {
    display: block !important; width: auto !important; max-width: 100% !important; min-width: 0 !important; height: auto !important;
  }
  html:root body:not(.landing) .cff-shell table.cff-stack > tbody > tr > td { padding: 8px 0 !important; text-align: center; }
  html:root body:not(.landing) .cff-shell table.cff-stack img { max-width: 100% !important; height: auto !important; }

  /* wide data tables scroll sideways on their own, name column pinned */
  html:root body:not(.landing) .cff-shell table.cff-sortable:not(.cff-tactics) {
    display: block !important; max-width: 100% !important; width: auto !important; overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  html:root body:not(.landing) .cff-shell table.cff-sortable:not(.cff-tactics) > tbody > tr > :first-child {
    position: sticky; left: 0; z-index: 1; background-color: var(--night-2) !important;
  }
  html:root body:not(.landing) .cff-shell table.cff-sortable:not(.cff-tactics) > tbody > tr > td.fondo:first-child,
  html:root body:not(.landing) .cff-shell table.cff-sortable:not(.cff-tactics) > tbody > tr > th:first-child { background-color: var(--night-3) !important; }
}
/* hidden tooltips (.tip span) took up room off-screen and made the page scroll sideways */
#content .tip span { display: none; max-width: min(23em, 80vw); }
#content .tip:hover span, #content .tip:focus span { display: block; }

/* Phones: denser tables (less padding, smaller type) so most fit without scrolling */
@media (max-width: 700px) {
  html:root body:not(.landing) .cff-shell { padding-left: 6px; padding-right: 6px; }
  html:root body:not(.landing) div#content { padding: 8px !important; }
  html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > * > tr > :is(td[class^="fondo"], th) {
    padding: 5px 3px !important; font: 700 11px/1.15 var(--body) !important; white-space: normal; letter-spacing: -.01em;
  }
  html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > tbody > tr > td:not([class^="fondo"]) {
    padding: 4px 3px !important; font: 400 12.5px/1.25 var(--body) !important;
  }
  html:root body:not(.landing) .cff-shell table td { padding-left: 3px !important; padding-right: 3px !important; }
  html:root body:not(.landing) .cff-shell table { font-size: 13px; }
  /* flags and small icons inside table cells */
  html:root body:not(.landing) .cff-shell td img:is([width="30"], [width="35"], [width="40"], [height="30"], [height="40"]) { width: 22px !important; height: auto !important; }
  html:root body:not(.landing) .cff-shell td img:is([width="20"], [width="25"]) { width: 16px !important; height: auto !important; }
  html:root body:not(.landing) .cff-shell .skill-bar { gap: 4px; }
  html:root body:not(.landing) .cff-shell .skill-bar img { width: 48px !important; height: auto !important; }
}
@media (max-width: 700px) {
  /* the ↕ hint takes a column's worth of room on 20-column tables; keep only ▲/▼ once sorted */
  .cff-sortable .cff-sort[aria-sort="none"]::after { content: none; }
  html:root body:not(.landing) .cff-shell table:has(> tbody > tr > td[class^="fondo"], > tbody > tr > th, > thead > tr > th) > * > tr > :is(td[class^="fondo"], th) { font-size: 10.5px !important; }
  html:root body:not(.landing) #content select { max-width: 100% !important; }
  html:root body:not(.landing) #content input:not([type="checkbox"], [type="radio"], [type="image"]) { max-width: 100% !important; }
}
@media (max-width: 700px) {
  html:root body:not(.landing) .cff-shell table.cff-tactics td form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  html:root body:not(.landing) .cff-shell table.cff-tactics td form select { flex: 1 1 100%; min-width: 0; }
}
