@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');

@font-face {
    font-family: 'Euclid Circular A';
    src: url('../assets/fonts/EuclidCircularA-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Euclid Circular A';
    src: url('../assets/fonts/EuclidCircularA-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Euclid Circular A';
    src: url('../assets/fonts/EuclidCircularA-Semibold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'Euclid Circular A';
    src: url('../assets/fonts/EuclidCircularA-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'icons';
    src: url('../assets/fonts/tdf-icons.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

@font-face {
  font-family: 'weathericons';
  src: url('../assets/fonts/weathericons-regular-webfont.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}

:root {
    /* Light mode colors */
    --background-color: #ffffff;
    --text-color: #1A1B25;
    --toggle-btn-background-color: #f8f8f8;
    --gc-table-odds-background-color: #f8f8f8;
    --tooltip-background-color: #f8f8f8;
    --rider-accent-background-color: #e8e8e9;
    --rider-accent-border-color: rgba(232, 232, 233, 0.5);
    --rider-accent-rider-bg: rgba(255, 255, 255, 0.5);
    --tooltip-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --winner-background-color: #e8e8e9;
    --winner-border: 2px solid #e8e8e9;
    --rider-background-color: #e8e8e9;
    --rider-border: 2px solid #e8e8e9;
}

/* Use html.dark-mode so theme can be applied in <head> before first paint (avoids flash when navigating) */
html.dark-mode,
body.dark-mode {
    /* Dark mode colors */
    --background-color: #1A1B25;
    --text-color: #e8e9ea;
    --toggle-btn-background-color: #31323b;
    --gc-table-odds-background-color: #31323b;
    --tooltip-background-color: #31323b;
    --rider-accent-background-color: #484951;
    --rider-accent-border-color: rgba(72, 73, 81, 0.5);
    --rider-accent-rider-bg: rgba(26, 27, 37, 0.5);
    --tooltip-box-shadow: 0 2px 4px rgba(232, 232, 233, 0.2);
    --winner-background-color: #31323b;
    --winner-border: 2px solid #31323b;
    --rider-background-color: #484951;
    --rider-border: 2px solid #484951;
}

body {
    font-family: 'Euclid Circular A', Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0 auto;
    max-width: 1420px;

    transition: background-color 0.22s ease-out, color 0.22s ease-out;
}

li {
    margin-left: 0; /* Adjust the space between bullet and text */
}

li::marker {
    margin-right: 2px; /* Adjust the space between bullet and text */
}

/* Tour de France logo outside the stage containers */
.tour-logo {
    max-width: 1052px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-year-group {
    display: flex;
    align-items: center;
    gap: 24px;
}

#tdf-logo {
    width: 90px;
    vertical-align: middle;
    display: block;
    margin-right: 24px;
}

.top-year-selector {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    display: inline-flex;
}

/* Home page header matches year-page header geometry exactly */
body.home-page .tour-logo {
    margin: 0 auto;
    position: static;
    min-height: 64px;
    max-width: 1052px;
    width: min(1052px, calc(100% - 32px));
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-start;
}

body.home-page {
}

body.home-page .logo-year-group {
    position: static;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

body.home-page .top-year-selector {
    order: 1;
    margin-right: 0;
    z-index: 2;
    max-width: none;
}

body.home-page .top-year-selector .custom-dropdown {
    min-width: 0;
}

body.home-page .logo-year-group > a {
    order: 2;
    flex: 0 0 auto;
}

body.home-page #tdf-logo {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    margin-right: 0;
}

body.home-page .toggle-container {
    order: 3;
    margin-left: auto;
}

body.home-page .switch::before {
    top: calc(100% + 6px);
    left: auto;
    right: 0;
    margin-top: 0;
    z-index: 1200;
}

@media (min-width: 769px) {
    body.home-page .tour-logo {
        position: relative;
        justify-content: space-between;
    }

    body.home-page .logo-year-group {
        gap: 0;
    }

    body.home-page .top-year-selector {
        margin-right: auto;
        max-width: calc(50% - 56px);
    }

    body.home-page #tdf-logo {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    body.home-page .toggle-container {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    body.home-page .tour-logo {
        margin: 16px 16px 14px 16px;
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "logo auth"
            "year year";
        column-gap: 8px;
        row-gap: 8px;
        align-items: center;
        min-height: auto;
    }

    body.home-page .logo-year-group {
        display: contents;
    }

    body.home-page .logo-year-group > a {
        grid-area: logo;
        justify-self: start;
    }

    body.home-page #tdf-logo {
        position: static;
        left: auto;
        top: auto;
        transform: none;
        width: clamp(64px, 16vw, 86px);
        margin-right: 0;
    }

    body.home-page .top-year-selector {
        grid-area: year;
        justify-self: start;
        order: 0;
        width: auto;
        max-width: 100%;
        min-width: 0;
        margin-right: 0;
        gap: 6px;
        flex-wrap: nowrap;
    }

    body.home-page #auth-header {
        grid-area: auth;
        justify-self: end;
    }

    body.home-page .toggle-container {
        order: 3;
        margin: 0 0 0 auto;
    }
}

@media (max-width: 480px) {
    body.home-page .dropdown-toggle {
        font-size: 28px;
    }

    body.home-page #year-select {
        width: 78px;
    }
}

.dropdown-arrow {
    width: 18px;
    height: 16px;
  }

  .custom-dropdown {
      position: relative;
      display: inline-block;
  }

  #year-select {
    width: 110px;
    display: flex;
    justify-content: flex-start;
  }

  .dropdown-toggle {
      font-family: 'Euclid Circular A', sans-serif;
      padding: 4px 12px;
      font-size: 40px;
      font-weight: 700;
      border-radius: 4px;
      border:none;
      background: var(--background-color);
      color: #ffed00;
      cursor: pointer;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      transition: background .3s ease;
  }

.dropdown-toggle::before {
    content: 'Select a year';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--toggle-btn-background-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-top: 4px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 300;
    white-space: nowrap;
    opacity: 0;
    transition: opacity .3s ease;
    z-index: 1000;
}

.dropdown-toggle:hover {
    outline: none;
    background: var(--toggle-btn-background-color);
}

  .dropdown-toggle:hover::before {
      opacity: 1;
  }

.dropdown-menu {
    position: absolute;
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--toggle-btn-background-color);
    box-shadow: var(--tooltip-box-shadow);
    border: 1px solid var(--rider-background-color);
    border-radius: 4px;
    margin-top: 4px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
  }

  .dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

  .dropdown-item {  
      padding: 4px 8px;
      margin: 2px 8px;
      cursor: pointer;
      font-size: 18px;
      font-weight: 700;
  }

  .dropdown-item:hover {
      background: var(--rider-background-color);
      color: var(--text-color);
      border-radius: 4px;    
      outline: none;
      text-decoration: none;
  }

  .dropdown-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

  .dropdown-item.gated {
    opacity: 0.35;
    pointer-events: none;
}

.tour-intro {
    width: 420px;
    min-width: 420px;
    max-width: 420px;
    flex: 0 0 420px; /* don't grow, don't shrink, stay at 420px */
    flex-shrink: 0;
    font-size: .82em;
    font-weight: 300;
    margin: 0;
}

.tour-intro a {
    color: var(--text-color);
    position: relative;
    transition: all 0.3s ease;
}

.tour-intro a:hover, .tour-intro a:focus {
    color: #1a1b25;
    background-color: rgba(255, 237, 0, .9); /* Optional: background color inside the box */
}

/* Milestone tooltip links styling - matches tour intro section */
.tooltip-start a,
.tooltip-move a,
.tooltip-lead-change a,
.tooltip-crash a,
.tooltip-mountain03 a,
.tooltip-mountain03-bonus a,
.tooltip-mountain02 a,
.tooltip-mountain02-bonus a,
.tooltip-mountain01 a,
.tooltip-mountain01-bonus a,
.tooltip-mountainHc a,
.tooltip-mountainHc-bonus a,
.tooltip-sprint a,
.tooltip-sprint-bonus a,
.tooltip-finish a,
.tooltip-finish-bonus a,
.tooltip-finish-03 a,
.tooltip-finish-02 a,
.tooltip-finish-01 a,
.tooltip-finish-Hc a {
    color: var(--text-color);
    position: relative;
    transition: all 0.3s ease;
}

.tooltip-start a:hover,
.tooltip-move a:hover,
.tooltip-lead-change a:hover,
.tooltip-crash a:hover,
.tooltip-mountain03 a:hover,
.tooltip-mountain03-bonus a:hover,
.tooltip-mountain02 a:hover,
.tooltip-mountain02-bonus a:hover,
.tooltip-mountain01 a:hover,
.tooltip-mountain01-bonus a:hover,
.tooltip-mountainHc a:hover,
.tooltip-mountainHc-bonus a:hover,
.tooltip-sprint a:hover,
.tooltip-sprint-bonus a:hover,
.tooltip-finish a:hover,
.tooltip-finish-bonus a:hover,
.tooltip-finish-03 a:hover,
.tooltip-finish-02 a:hover,
.tooltip-finish-01 a:hover,
.tooltip-finish-Hc a:hover,
.tooltip-start a:focus,
.tooltip-move a:focus,
.tooltip-lead-change a:focus,
.tooltip-crash a:focus,
.tooltip-mountain03 a:focus,
.tooltip-mountain03-bonus a:focus,
.tooltip-mountain02 a:focus,
.tooltip-mountain02-bonus a:focus,
.tooltip-mountain01 a:focus,
.tooltip-mountain01-bonus a:focus,
.tooltip-mountainHc a:focus,
.tooltip-mountainHc-bonus a:focus,
.tooltip-sprint a:focus,
.tooltip-sprint-bonus a:focus,
.tooltip-finish a:focus,
.tooltip-finish-bonus a:focus,
.tooltip-finish-03 a:focus,
.tooltip-finish-02 a:focus,
.tooltip-finish-01 a:focus,
.tooltip-finish-Hc a:focus {
    color: #1a1b25;
    background-color: rgba(255, 237, 0, .9);
}

.tour-intro h3 {
    font-size: 1em;
    font-weight: 600;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tour-intro .icon-text {
    font-weight: 700;
}

.tour-intro .total-distance {
    margin-right: 12px;
}

.tour-intro .flat-stages {
    margin-left: 1em;
}

.tour-intro .avg-speed {
    background-color: var(--toggle-btn-background-color);
    padding: 2px 8px;
    margin-left: 1.5em;
    border-radius: 12px;
}

/* Custom tooltip styling */
.tour-intro-details {
    position: relative;
    margin-right: 1em;
}
.tour-intro-details:last-child {
    margin-right: 0;
}

.tour-intro-details::before {
    position: absolute;
    
    top: -28px;
    background: var(--toggle-btn-background-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-bottom:2px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 300;
    white-space: nowrap;
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}

.tour-intro-details:hover::before {
    opacity: 1;
}

.total-distance::before {
    content: 'Total Distance';
    transform: translateX(-2%);
}

.flat-stages::before {
    content: 'Flat Stages';
    transform: translateX(-30%);
}

.hilly-stages::before {
    content: 'Hilly Stages';
    transform: translateX(-40%);
}

.mountain-stages::before {
    content: 'Mountain Stages';
    transform: translateX(-40%);
}

.time-trial-stages::before {
    content: 'Time Trial Stages';
    transform: translateX(-40%);
}

.avg-speed::before {
    content: 'Average Speed of Winner';
    transform: translateX(-30%);
}

/* Toggle winners & results: circular button with eye icon (matches .theme-toggle-btn) */
.toggle-winners-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    font-family: inherit;
    color: var(--text-color);
    background: transparent;
    border: 1.5px solid color-mix(in srgb, var(--text-color) 22%, transparent);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.toggle-winners-btn::before {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--tooltip-background-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-top: 4px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 300;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}
.toggle-winners-btn:hover::before,
.toggle-winners-btn:focus::before {
    opacity: 1;
}
.toggle-winners-btn:hover {
    border-color: color-mix(in srgb, var(--text-color) 50%, transparent);
    background: color-mix(in srgb, var(--text-color) 6%, transparent);
}
.toggle-winners-btn:focus-visible {
    outline: 2px solid rgba(255, 237, 0, 0.7);
    outline-offset: 2px;
}
.toggle-winners-btn .icon-eye,
.toggle-winners-btn .icon-eye-off {
    width: 20px;
    height: 20px;
    pointer-events: none;
}
.toggle-winners-btn .icon-eye-off {
    display: none;
}
.toggle-winners-btn.winners-hidden .icon-eye {
    display: none;
}
.toggle-winners-btn.winners-hidden .icon-eye-off {
    display: inline-block;
}
.icon-eye {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-color: currentColor;
    mask: url('../assets/icons/eye.svg') center / contain no-repeat;
    -webkit-mask: url('../assets/icons/eye.svg') center / contain no-repeat;
}
.icon-eye-off {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-color: currentColor;
    mask: url('../assets/icons/eye-off.svg') center / contain no-repeat;
    -webkit-mask: url('../assets/icons/eye-off.svg') center / contain no-repeat;
}

.txtnav {
    display: inline-block;
    margin: 0 1px;
    padding: 2px 4px 4px 4px;
    border-radius: 4px;
    min-width: 16px;
    border: 1px solid var(--toggle-btn-background-color);
    font-size: .8em;
    font-weight: 700;
    line-height: normal;
    text-align: center;
}

.txtnav-modifier {
    display: inline-block;
    margin: 0 1px;
    padding: 2px 4px 4px 4px;
    border-radius: 4px;
    border: 1px solid var(--toggle-btn-background-color);
    font-size: 1em;
    font-weight: 400;
    line-height: normal;
    text-align: center;
}

.year-header {
    font-size: 72px;
    font-weight: bold;
    margin: 96px 0 -48px 140px;
    color: rgba(255, 237, 0, 0.5);
}

/* Stage row wrapper */
.stage-layout {
    display: flex;
    align-items: center;
    width: fit-content;
    margin: 50px 0;
}

/* Stage profile block (number + profile + milestones) */
.stage-container {
    display: flex;
    align-items: center;
    height: 240px;
    width: fit-content;
    margin: 0;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* Stage number on the left */
.stage-number {
    display: flex;
    justify-content: flex-end;
    align-self: flex-end;
    font-size: 72px;
    font-weight: 700;
    width: 80px;
    color: rgba(255, 237, 0, 0.5);
    flex-shrink: 0;
    text-align: right;
    margin: 0 20px -1px 40px;
}

.stage-profile {
    min-width: 800px;
    display: flex;
    align-self: flex-end;
    margin-bottom: 18px;
}

.milestone-buttons-container {
    max-width: 20px;
}

/* Milestones on the Stage Profiles*/
.milestone {
    position: absolute;
    min-width: 24px;
    min-height: 24px;
    display: flex;
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
}

.flag,
.flag-scale {
    width: 24px;
    height: auto;
    opacity: .5;
    transition: opacity 0.5s ease, visibility 0.5s ease; /* Transition effect */
}
        
.flag:hover,
.flag-scale:hover {
    opacity: 1;
    transition: opacity 0.5s ease, visibility 0.5s ease; /* Transition effect */
}

.flag-scale {
    margin-right: 12px;
}

/* Milestone for a key move of the day */
.radiating-circle {
    width: 8px;
    height: 8px;
    background-color: #FBAD28;
    border-radius: 50%;
    position: absolute;
    box-shadow: 0 0 4px rgba(251, 173, 40, 0.7),
                0 0 8px rgba(251, 173, 40, 0.5),
                0 0 12px rgba(251, 173, 40, 0.3);
    animation: pulse 1.5s infinite;
}

/* Enhanced radiating circle for lead changes (two expanding rings) */
.radiating-circle.lead-change::before,
.radiating-circle.lead-change::after {
    content: "";
    position: absolute;
    border: 2px solid rgba(251, 173, 40, 0.9);
    border-radius: 50%;
    inset: -6px;
    opacity: 0;
    animation: leadChangeRing 1.8s infinite;
}

.radiating-circle.lead-change::after {
    inset: -14px;
    animation-delay: 0.4s;
}

/* Pulsating animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 4px rgba(251, 173, 40, 0.7), 
                    0 0 8px rgba(251, 173, 40, 0.5),
                    0 0 12px rgba(251, 173, 40, 0.3);
    }
    50% {
        transform: scale(1.5);
        box-shadow: 0 0 6px rgba(251, 173, 40, 0.8), 
                    0 0 12px rgba(251, 173, 40, 0.6),
                    0 0 18px rgba(251, 173, 40, 0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 4px rgba(251, 173, 40, 0.7), 
                    0 0 8px rgba(251, 173, 40, 0.5),
                    0 0 12px rgba(251, 173, 40, 0.3);
    }
}

@keyframes leadChangeRing {
    0% {
        transform: scale(0.7);
        opacity: 0.9;
    }
    60% {
        transform: scale(1.2);
        opacity: 0;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Home hero: larger expanding rings (same 8px dot, bigger ripple) */
@keyframes homeHeroLeadChangeRing {
    0% {
        transform: scale(0.65);
        opacity: 0.9;
    }
    55% {
        transform: scale(1.35);
        opacity: 0;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Home hero: lead-change deco — motion over 20s, then 3s idle before loop (23s total) */
@keyframes homeHeroLeadChangeMove {
    /* Corner 1 (top-right) — percents scaled × 20/23 so 100% = 23s real time */
    0% {
        top: 8%;
        right: min(6%, 48px);
        left: auto;
        bottom: auto;
        opacity: var(--hero-lc-opacity, 0.42);
    }
    4.348% {
        top: 8%;
        right: min(6%, 48px);
        left: auto;
        bottom: auto;
        opacity: var(--hero-lc-opacity, 0.42);
    }
    13.043% {
        top: 8%;
        right: min(6%, 48px);
        left: auto;
        bottom: auto;
        opacity: 0;
    }
    13.913% {
        top: 8%;
        right: min(6%, 48px);
        left: auto;
        bottom: auto;
        opacity: 0;
    }
    14.783% {
        top: 8%;
        left: min(8%, 56px);
        right: auto;
        bottom: auto;
        opacity: 0;
    }
    20.87% {
        top: 8%;
        left: min(8%, 56px);
        right: auto;
        bottom: auto;
        opacity: var(--hero-lc-opacity, 0.42);
    }
    21.739% {
        top: 8%;
        left: min(8%, 56px);
        right: auto;
        bottom: auto;
        opacity: var(--hero-lc-opacity, 0.42);
    }

    26.087% {
        top: 8%;
        left: min(8%, 56px);
        right: auto;
        bottom: auto;
        opacity: var(--hero-lc-opacity, 0.42);
    }
    34.783% {
        top: 8%;
        left: min(8%, 56px);
        right: auto;
        bottom: auto;
        opacity: 0;
    }
    35.652% {
        opacity: 0;
    }
    36.522% {
        top: auto;
        bottom: 14%;
        left: min(8%, 56px);
        right: auto;
        opacity: 0;
    }
    42.609% {
        top: auto;
        bottom: 14%;
        left: min(8%, 56px);
        right: auto;
        opacity: var(--hero-lc-opacity, 0.42);
    }
    43.478% {
        top: auto;
        bottom: 14%;
        left: min(8%, 56px);
        right: auto;
        opacity: var(--hero-lc-opacity, 0.42);
    }

    47.826% {
        top: auto;
        bottom: 14%;
        left: min(8%, 56px);
        right: auto;
        opacity: var(--hero-lc-opacity, 0.42);
    }
    56.522% {
        top: auto;
        bottom: 14%;
        left: min(8%, 56px);
        right: auto;
        opacity: 0;
    }
    57.391% {
        opacity: 0;
    }
    58.261% {
        top: auto;
        bottom: 14%;
        right: min(6%, 48px);
        left: auto;
        opacity: 0;
    }
    64.348% {
        top: auto;
        bottom: 14%;
        right: min(6%, 48px);
        left: auto;
        opacity: var(--hero-lc-opacity, 0.42);
    }
    65.217% {
        top: auto;
        bottom: 14%;
        right: min(6%, 48px);
        left: auto;
        opacity: var(--hero-lc-opacity, 0.42);
    }

    69.565% {
        top: auto;
        bottom: 14%;
        right: min(6%, 48px);
        left: auto;
        opacity: var(--hero-lc-opacity, 0.42);
    }
    78.261% {
        top: auto;
        bottom: 14%;
        right: min(6%, 48px);
        left: auto;
        opacity: 0;
    }
    79.13% {
        opacity: 0;
    }
    80% {
        top: 8%;
        right: min(6%, 48px);
        left: auto;
        bottom: auto;
        opacity: 0;
    }
    86.087% {
        top: 8%;
        right: min(6%, 48px);
        left: auto;
        bottom: auto;
        opacity: var(--hero-lc-opacity, 0.42);
    }
    /* 3s rest (86.957%–100%) before next loop */
    86.957%, 100% {
        top: 8%;
        right: min(6%, 48px);
        left: auto;
        bottom: auto;
        opacity: var(--hero-lc-opacity, 0.42);
    }
}

@keyframes homeHeroLeadChangeMoveMobile {
    0% {
        top: 4%;
        right: 12px;
        left: auto;
        bottom: auto;
        opacity: var(--hero-lc-opacity, 0.32);
    }
    4.348% {
        top: 4%;
        right: 12px;
        left: auto;
        bottom: auto;
        opacity: var(--hero-lc-opacity, 0.32);
    }
    13.043% {
        top: 4%;
        right: 12px;
        left: auto;
        bottom: auto;
        opacity: 0;
    }
    13.913% {
        opacity: 0;
    }
    14.783% {
        top: 4%;
        left: 12px;
        right: auto;
        bottom: auto;
        opacity: 0;
    }
    20.87% {
        top: 4%;
        left: 12px;
        right: auto;
        bottom: auto;
        opacity: var(--hero-lc-opacity, 0.32);
    }
    21.739% {
        top: 4%;
        left: 12px;
        right: auto;
        bottom: auto;
        opacity: var(--hero-lc-opacity, 0.32);
    }

    26.087% {
        opacity: var(--hero-lc-opacity, 0.32);
    }
    34.783% {
        opacity: 0;
    }
    35.652% {
        opacity: 0;
    }
    36.522% {
        top: auto;
        bottom: 10%;
        left: 12px;
        right: auto;
        opacity: 0;
    }
    42.609% {
        opacity: var(--hero-lc-opacity, 0.32);
    }
    43.478% {
        top: auto;
        bottom: 10%;
        left: 12px;
        right: auto;
        opacity: var(--hero-lc-opacity, 0.32);
    }

    47.826% {
        opacity: var(--hero-lc-opacity, 0.32);
    }
    56.522% {
        opacity: 0;
    }
    57.391% {
        opacity: 0;
    }
    58.261% {
        top: auto;
        bottom: 10%;
        right: 12px;
        left: auto;
        opacity: 0;
    }
    64.348% {
        opacity: var(--hero-lc-opacity, 0.32);
    }
    65.217% {
        top: auto;
        bottom: 10%;
        right: 12px;
        left: auto;
        opacity: var(--hero-lc-opacity, 0.32);
    }

    69.565% {
        opacity: var(--hero-lc-opacity, 0.32);
    }
    78.261% {
        opacity: 0;
    }
    79.13% {
        opacity: 0;
    }
    80% {
        top: 4%;
        right: 12px;
        left: auto;
        bottom: auto;
        opacity: 0;
    }
    86.087% {
        top: 4%;
        right: 12px;
        left: auto;
        bottom: auto;
        opacity: var(--hero-lc-opacity, 0.32);
    }
    86.957%, 100% {
        top: 4%;
        right: 12px;
        left: auto;
        bottom: auto;
        opacity: var(--hero-lc-opacity, 0.32);
    }
}

/* Tooltips for Milestone details*/
.tooltip-start,
.tooltip-move,
.tooltip-lead-change,
.tooltip-crash,
.tooltip-mountain03,
.tooltip-mountain03-bonus,
.tooltip-mountain02,
.tooltip-mountain02-bonus,
.tooltip-mountain01,
.tooltip-mountain01-bonus,
.tooltip-mountainHc,
.tooltip-mountainHc-bonus,
.tooltip-sprint,
.tooltip-sprint-bonus,
.tooltip-finish,
.tooltip-finish-bonus,
.tooltip-finish-03,
.tooltip-finish-02,
.tooltip-finish-01,
.tooltip-finish-Hc {
    opacity: 0; /* Initially hidden */
    visibility: hidden; /* Hidden until hovered */
    transition: opacity 0.5s ease, visibility 0.5s ease; /* Transition effect */
    display: flex;
    flex-direction: row;
    align-items: center; /* Centers the image horizontally */
    position: absolute;
    font-size: 10px;
    width: 320px;
    background-color: var(--tooltip-background-color);
    border-radius: 4px;
    padding: 0 8px;
    text-align: left;
    z-index: 9;
    cursor: default;
    box-shadow: var(--tooltip-box-shadow)
}

[class^="tooltip-"] p,
[class*=" tooltip-"] p {
    font-family: 'Inter', Verdana,sans-serif;
    font-size: 11px;
    line-height: 1.4;
}

.tooltip-title-icon {
    margin-right: 2px;
}

[class^="tooltip-"] .rider-team,
[class*=" tooltip-"] .rider-team {
    font-size: 0.85em;
    font-weight: 300;
    opacity: 0.5;
    margin-left: 4px;
}

.milestone.active .tooltip-start, 
.milestone.active .tooltip-move,
.milestone.active .tooltip-lead-change,
.milestone.active .tooltip-crash,
.milestone.active .tooltip-mountain03,
.milestone.active .tooltip-mountain03-bonus,
.milestone.active .tooltip-mountain02,
.milestone.active .tooltip-mountain02-bonus,
.milestone.active .tooltip-mountain01,
.milestone.active .tooltip-mountain01-bonus,
.milestone.active .tooltip-mountainHc,
.milestone.active .tooltip-mountainHc-bonus,
.milestone.active .tooltip-sprint, 
.milestone.active .tooltip-sprint-bonus,
.milestone.active .tooltip-finish,
.milestone.active .tooltip-finish-bonus,
.milestone.active .tooltip-finish-03,
.milestone.active .tooltip-finish-02,
.milestone.active .tooltip-finish-01,
.milestone.active .tooltip-finish-Hc,
.milestone.active .milestone-tab, 
.milestone.active .flag {
    display: flex;
    z-index: 5;
    opacity: 1; /* Fully visible */
    visibility: visible; /* Tooltip becomes visible */
}

.milestone:hover .tooltip-start, 
.milestone:hover .tooltip-move,
.milestone:hover .tooltip-lead-change,
.milestone:hover .tooltip-crash,
.milestone:hover .tooltip-mountain03,
.milestone:hover .tooltip-mountain03-bonus,
.milestone:hover .tooltip-mountain02, 
.milestone:hover .tooltip-mountain02-bonus,
.milestone:hover .tooltip-mountain01,
.milestone:hover .tooltip-mountain01-bonus,
.milestone:hover .tooltip-mountainHc,
.milestone:hover .tooltip-mountainHc-bonus,
.milestone:hover .tooltip-sprint, 
.milestone:hover .tooltip-sprint-bonus,
.milestone:hover .tooltip-finish,
.milestone:hover .tooltip-finish-bonus,
.milestone:hover .tooltip-finish-03,
.milestone:hover .tooltip-finish-02,
.milestone:hover .tooltip-finish-01,
.milestone:hover .tooltip-finish-Hc, 
.milestone:hover .flag {
    display: flex;
    z-index: 10;
    opacity: 1; /* Fully visible */
    visibility: visible; /* Tooltip becomes visible */
}
      
.tooltip-start {
    border-bottom: 4px solid #0078BC;
}

.start-date-badge {
    position: absolute;
    top: 14px;
    right: 16px;
    font-family: 'Inter', Verdana, sans-serif;
    font-size: 10px;
    background-color: rgba(0, 120, 188, 0.12);
    color: #0078BC;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1;
}

.start-date-badge .date-value {
    opacity: 1;
}

.start-date-badge .date-calendar-icon {
    opacity: 0.7;
    vertical-align: middle;
}

.start-type-badge {
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 10px;
    font-weight: 500;
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
}

.start-type-badge .icon-text {
    font-size: 13px;
}

.start-type-badge[data-stage-type="flat"] {
    background-color: rgba(59, 170, 49, 0.12);
    color: #3BAA31;
}

.start-type-badge[data-stage-type="hilly"] {
    background-color: rgba(235, 150, 30, 0.12);
    color: #EB961E;
}

.start-type-badge[data-stage-type="mountain"] {
    background-color: rgba(195, 15, 25, 0.12);
    color: #C30F19;
}

.start-type-badge[data-stage-type="itt"],
.start-type-badge[data-stage-type="ittmtn"],
.start-type-badge[data-stage-type="ttt"] {
    background-color: rgba(0, 120, 188, 0.12);
    color: #0078BC;
}

.start-weather-line {
    position: absolute;
    top: 32px;
    right: 16px;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--text-color);
    opacity: 0.6;
    background-color: var(--gc-table-odds-background-color);
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

.start-weather-line .weather-text {
    font-family: 'weathericons';
}

.tooltip-move,
.tooltip-lead-change,
.tooltip-crash {
    border-bottom: 4px solid #FBAD28;
}
 
.tooltip-mountain03,
.tooltip-mountain03-bonus,
.tooltip-mountain02,
.tooltip-mountain02-bonus,
.tooltip-mountain01,
.tooltip-mountain01-bonus,
.tooltip-mountainHc,
.tooltip-mountainHc-bonus,
.tooltip-finish,
.tooltip-finish-bonus,
.tooltip-finish-03,
.tooltip-finish-02,
.tooltip-finish-01,
.tooltip-finish-Hc {
    border-bottom: 4px solid #C30F19;
}
        
.tooltip-sprint,
.tooltip-sprint-bonus {
    border-bottom: 4px solid #3BAA31;
}

.tooltip-move,
.tooltip-lead-change,
.tooltip-crash,
.tooltip-mountain03,
.tooltip-mountain03-bonus,
.tooltip-mountain02,
.tooltip-mountain02-bonus,
.tooltip-mountain01,
.tooltip-mountain01-bonus,
.tooltip-mountainHc,
.tooltip-mountainHc-bonus,
.tooltip-sprint,
.tooltip-sprint-bonus {
    padding: 0;
}


/* Milestone-tab interaction styles */
.milestone-tab:hover {
    cursor: pointer; /* Changes cursor to indicate interactivity */
    filter: brightness(1.2); /* Optional effect to make it stand out */
    transform: scaleX(1.5) scaleY(1);
    opacity: 1;
}



/* Tooltip for milestone-tab interaction */
.milestone-tab:hover + .milestone .tooltip-start,
.milestone-tab:hover + .milestone .tooltip-move,
.milestone-tab:hover + .milestone .tooltip-crash,
.milestone-tab:hover + .milestone .tooltip-mountain03,
.milestone-tab:hover + .milestone .tooltip-mountain03-bonus,
.milestone-tab:hover + .milestone .tooltip-mountain02,
.milestone-tab:hover + .milestone .tooltip-mountain02-bonus,
.milestone-tab:hover + .milestone .tooltip-mountain01,
.milestone-tab:hover + .milestone .tooltip-mountain01-bonus,
.milestone-tab:hover + .milestone .tooltip-mountainHc,
.milestone-tab:hover + .milestone .tooltip-mountainHc-bonus,
.milestone-tab:hover + .milestone .tooltip-sprint,
.milestone-tab:hover + .milestone .tooltip-sprint-bonus,
.milestone-tab:hover + .milestone .tooltip-finish,
.milestone-tab:hover + .milestone .tooltip-finish-bonus,
.milestone-tab:hover + .milestone .tooltip-finish-03,
.milestone-tab:hover + .milestone .tooltip-finish-02,
.milestone-tab:hover + .milestone .tooltip-finish-01,
.milestone-tab:hover + .milestone .tooltip-finish-Hc,
.milestone-tab:hover + .milestone .flag {
    opacity: 1;
    visibility: visible;
}

/* Base styling for milestone tabs */
.milestone-tab {
    position: absolute; /* Absolute positioning relative to the first parent that isn't static */
    width: 24px;
    height: 4px;
    border-radius: 2px;
    left: 0; /* Align to the left */
    opacity: .4;
    background-color: #ccc; /* Example color, change as needed */
    transition: opactiy 0.3s ease, transform 0.3s ease; /* Smooth scaling effect */
}

/* Use a pseudo-element to expand the hoverable and clickable area */
.milestone-tab::before {
    content: "";             /* Required for pseudo-elements */
    position: absolute;      /* Absolute positioning relative to the parent */
    top: -10px;              /* Expand clickable area above */
    bottom: -4px;           /* Expand clickable area below */
    left: 0px;             /* Expand clickable area to the left */
    right: -24px;            /* Expand clickable area to the right */
    z-index: -1;             /* Keep it behind the actual visual content */
}

.milestone-tab.active {
    transform: scaleX(1.8) scaleY(1);
    filter: brightness(1.2);
    opacity: 1;
    transition: transform 0.3s, filter 0.3s;
}

/* Position each tab with a top value incremented based on its index */
.milestone-tab:last-child {
    top: 218px !important;
}

.stage-container > .milestone-tab:nth-last-child(1) {
    top: 218px;
}

.stage-container > .milestone-tab:nth-last-child(2) {
    top: 218px;
}

.stage-container > .milestone-tab:nth-last-child(3) {
    top: 218px;
}

.stage-container .milestone-tab:nth-last-child(4) {
    top: 218px;
}

.stage-container .milestone-tab:nth-last-child() {
    top: 218px;
}

.rider-accent {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2px;
    border-radius: 4px 0 0 4px;
    align-self: stretch;
    background-color: var(--rider-accent-background-color);
}

.rider-accent .rider {
    border: 2px solid var(--rider-accent-border-color);
    background-color: var(--rider-accent-rider-bg);
}

.rider {
    width: 45px;
    height: 45px;
    margin: 8px 0;
    background-color: var(--rider-background-color);
    border-radius: 50px;
    display: block;
    border: var(--rider-border);
}
        
.tooltip-content {
    min-width: 220px;
    margin: 8px; /* Adds space between image and text */
}

.tooltip-start .tooltip-content {
    min-width: 300px;
    margin: 8px; /* Adds space between image and text */
}
        
h3 {
    margin: 4px 0 0px 0;
    font-size: 16px;
    font-weight: 400;
}
        
h4 {
    margin: 2px 0;
    font-size: 12px;

}

h5 {
    margin: 2px 0;
    font-size: 12px;
    font-weight: 700;
}
        
.tooltip-subtitle {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 10px;
    color: var(--text-color);
}

/* Date, weather, temperature, and elevation styling with reduced opacity */
.tooltip-subtitle .date-value,
.tooltip-subtitle .date-calendar-icon,
.tooltip-subtitle .weather-text,
.tooltip-subtitle .temperature-value,
.tooltip-subtitle .elevation-value {
    opacity: 0.6;
}

.tooltip-subtitle .date-calendar-icon {
    margin-right: 2px;
    vertical-align: -1px;
}

.tooltip-subtitle .elevation-icon {
    font-size: 11px;
    margin-right: 2px;
    vertical-align: -1px;
    opacity: 0.6;
}

.tooltip-subtitle .starters-icon {
    margin-right: 2px;
    vertical-align: -1px;
    opacity: 0.6;
}

.tooltip-subtitle .starters-value {
    opacity: 0.6;
}

/* Points badge styling for sprint and finish tooltips */
.tooltip-sprint .points-value,
.tooltip-sprint-bonus .points-value,
.tooltip-finish .points-value,
.tooltip-finish-bonus .points-value,
.tooltip-finish-03 .points-value,
.tooltip-finish-02 .points-value,
.tooltip-finish-01 .points-value,
.tooltip-finish-Hc .points-value {
    color: #3BAA31;
    background-color: rgba(59, 170, 49, 0.12);
    padding: 2px 5px;
    border-radius: 3px;
    opacity: 1;
    font-weight: 700;
}

/* Bonus badge styling for all tooltips */
.tooltip-start .bonus-value,
.tooltip-move .bonus-value,
.tooltip-lead-change .bonus-value,
.tooltip-crash .bonus-value,
.tooltip-mountain03 .bonus-value,
.tooltip-mountain03-bonus .bonus-value,
.tooltip-mountain02 .bonus-value,
.tooltip-mountain02-bonus .bonus-value,
.tooltip-mountain01 .bonus-value,
.tooltip-mountain01-bonus .bonus-value,
.tooltip-mountainHc .bonus-value,
.tooltip-mountainHc-bonus .bonus-value,
.tooltip-sprint .bonus-value,
.tooltip-sprint-bonus .bonus-value,
.tooltip-finish .bonus-value,
.tooltip-finish-bonus .bonus-value,
.tooltip-finish-03 .bonus-value,
.tooltip-finish-02 .bonus-value,
.tooltip-finish-01 .bonus-value,
.tooltip-finish-Hc .bonus-value {
    color: #D4A017;
    background-color: rgba(212, 160, 23, 0.12);
    padding: 2px 5px;
    border-radius: 3px;
    opacity: 1;
    font-weight: 700;
}

/* Mountains badge styling for all tooltips */
.tooltip-start .mountains-value,
.tooltip-move .mountains-value,
.tooltip-lead-change .mountains-value,
.tooltip-crash .mountains-value,
.tooltip-mountain03 .mountains-value,
.tooltip-mountain03-bonus .mountains-value,
.tooltip-mountain02 .mountains-value,
.tooltip-mountain02-bonus .mountains-value,
.tooltip-mountain01 .mountains-value,
.tooltip-mountain01-bonus .mountains-value,
.tooltip-mountainHc .mountains-value,
.tooltip-mountainHc-bonus .mountains-value,
.tooltip-sprint .mountains-value,
.tooltip-sprint-bonus .mountains-value,
.tooltip-finish .mountains-value,
.tooltip-finish-bonus .mountains-value,
.tooltip-finish-03 .mountains-value,
.tooltip-finish-02 .mountains-value,
.tooltip-finish-01 .mountains-value,
.tooltip-finish-Hc .mountains-value {
    color: #C30F19;
    background-color: rgba(195, 15, 25, 0.12);
    padding: 2px 5px;
    border-radius: 3px;
    opacity: 1;
    font-weight: 700;
}
        
.tooltip-start p,
.tooltip-move p,
.tooltip-lead-change p,
.tooltip-crash p,
.tooltip-mountain03 p,
.tooltip-mountain03-bonus p,
.tooltip-mountain02 p,
.tooltip-mountain02-bonus p, 
.tooltip-mountain01 p,
.tooltip-mountain01-bonus p,
.tooltip-mountainHc p,
.tooltip-mountainHc-bonus p,
.tooltip-sprint p,
.tooltip-sprint-bonus p,
.tooltip-finish p,
.tooltip-finish-bonus p,
.tooltip-finish-03 p,
.tooltip-finish-02 p,
.tooltip-finish-01 p,
.tooltip-finish-Hc p {
    margin: 0 0 4px 0;
    align-self: flex-start; /* Aligns text to the top (left by default) */
}

/* Text for distances underneath stage profiles*/
.distance {
    font-size: 12px;
    font-weight: 600;
    color: #FFED00;
    position: absolute;
    white-space: nowrap;
    bottom: 0px;
    transform: translateX(-50%);
}

.distance-scale,
.height-scale {
    font-size: 12px;
    font-weight: 600;
    position: absolute;
    white-space: nowrap;
}

.distance-scale {
    color: #FFED00;
}

.height-scale {
    color: #FBAD28;
    padding: 0px 2px;
    line-height: 1;
    border-radius: 8px;
    background-color: var(--background-color);
}

/* Results tables for general classification, jerseys and stage winners */
.gc-table-section {
    display: flex;
    align-self: flex-end;
    margin-bottom: 18px;
}

.winners-table {
    margin-top: 4px;
}
        
.gc-table, 
.winners-table {
    width: 300px;
    border-collapse: collapse;
}
        
/* GC Table header for jersey links*/
.gc-table th {
    background-color: var(--background-color);
    text-align: left;
    vertical-align: middle;
    padding-left: 8px;
    font-size: 24px;
    transition: background-color 0.5s ease;
}
        
.jersey-link {
    text-decoration: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    opacity: 0.36; /* Default opacity for non-selected jerseys */
    transition: opacity 0.3s ease; /* Smooth transition when changing opacity */
}

.jersey-link:hover {
    opacity: 1; /* Full opacity when selected */
}

.jersey-link.selected {
    opacity: 1; /* Full opacity when selected */
}

/* Custom tooltip styling */
.jersey-link::before {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: -30px;
    background: var(--toggle-btn-background-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-bottom:2px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 300;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease;
    pointer-events: none;
    z-index: 10;
}

.jersey-link:hover::before,
.jersey-link:focus-visible::before {
    opacity: 1;
    visibility: visible;
}

.yellow-jersey-link {
    color: #FFED00;
}

.green-jersey-link {
    color: #3BAA31;
}

.polka-jersey-link {
    color: #C30F19;
}


/* Table rows for both general classification and winners tables */
.gc-table tr {
    height: 35px;
}

.gc-table td,
.winners-table td {
    padding-top: 4px;
    padding-bottom: 4px;
    vertical-align: middle;
    line-height: 12px;
}

.gc-table td:last-child {
    padding-right: 12px;
}
        
.winners-table .arrow-cell,
.gc-table .arrow-cell {
    width: 14px; /* Fixed width for the arrow column */
}

.winners-table .position,
.gc-table .position {
    width: 14px; /* Fixed width for the position column */
}

.winners-table .rider-flag,
.gc-table .rider-flag {
    width: 30px; /* Fixed width for the flag column */
}

.winners-table .name,
.gc-table .name {
    width: 150px; /* Adjust as needed */
}

.winners-table .time,
.gc-table .time {
    width: 90px; /* Fixed width for the time column */
    text-align: right; /* Ensure time aligns to the right */
}
        
/* Country flag for tables */
.rider-flag img {
    width: 25px;
    height: auto;
    vertical-align: middle;
    font-size: 8px;
}

/* Name and team */
.name {
    font-weight: bold;
    color: var(--text-color);
    font-size: 12px;
    white-space: nowrap;
    width: 150px;
}

.team {
    color: var(--text-color);
    font-size: 10px;
    opacity: .6;
}

/* Time of results */
.time {
    font-size: 12px;
    white-space: nowrap;
    text-align: right; /* Aligns the text to the right */
    width: 90px;
}

/* Arrows for position change */
.arrow {
    display: inline-block;
    vertical-align: middle;
    font-size: 12px;
}

.up-arrow {
    color: #3BAA31;
}

.down-arrow {
    color: #C30F19;
}

/* Row styling */
.gc-table tr:nth-child(odd) {
    background-color: var(--gc-table-odds-background-color);
    transition: background-color 0.5s ease;
}

.gc-table tr:nth-child(even) {
    background-color: var(--background-color);
    transition: background-color 0.5s ease;
}
        
.arrow-cell {
    width: 14px; /* Fixed width for arrow */
    text-align: center; /* Center the arrow in the column */
}

.position {
    padding-right: 2px;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    width: 14px;
}

.icon-text {
    font-family: 'icons';
}

.weather-text {
    font-family: 'weathericons';
}

/* Winner section */
.stage-winner {
    display: flex;
    flex-shrink: 0;
    flex-direction: column; /* Stack image, name, and team vertically */
    align-items: center; /* Horizontally center the content */
    justify-content: center; /* Vertically center the content */
    width: 180px; /* Fixed width for the winner section */
    text-align: center;
}

.winner-details {
    display: flex;
    flex-direction: column;
    align-items: center;
}


.tour-winners-title {
    margin: 120px 0 24px;
    font-family: 'Euclid Circular A';
    font-weight: 700;
    font-size: clamp(42px, 7vw, 72px);
    color: rgba(255, 237, 0, 0.5);
    text-align: center;
}

.tour-winners-container {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 24px;
}

.tour-winners-container.is-hidden {
    display: none;
}

.tour-winners {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px; /* Space between the winner divs */
    align-items: start; /* Alignment of items inside individual grid cells */
    justify-items: center; /* Horizontal alignment of items inside individual grid cells */
    justify-content: center; /* Centers the entire grid horizontally */
    align-content: start; /* Centers the entire grid vertically */
    margin: 0 auto; /* Ensures the grid is horizontally centered in its parent container */
}

@media (max-width: 900px) {
    .tour-winners {
        grid-template-columns: 1fr;
        max-width: 260px;
    }
}

.tour-winner-class {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: min(100%, 240px);
    text-align: center;
}

.winner-img,
.tour-winner-img {
    border-radius: 50%; /* Circular profile image */
    margin-bottom: 4px;
    background-color: var(--winner-background-color);
    border: var(--winner-border);
    transition: background-color 0.5s ease, border 0.5s ease;
}

.winner-img {
    width: 60px;
    height: 60px;
}

.tour-winner-img {
    width: 72px;
    height: 72px;
}

.yellow {
    border: 4px solid #ffed00;
    background-color: rgba(255, 237, 0, .10);
}

.green {
    border: 4px solid #3BAA31;
    background-color: rgba(59, 170, 49, .10);
}

.polka {
    border: 4px solid #C30F19;
    background-color: rgba(195, 15, 25, .10);
}


.flag-img {
    height: 10px;
    margin-right: 4px;
}

.winner-name {
    font-weight: bold;
    font-size: 14px;
    line-height: 1.25;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.winner-team {
    font-size: 12px;
    color: var(--text-color);
    opacity: .6;
    font-weight: 300;
    line-height: 1.35;
    margin: 0;
}

.winner-speed {
    font-size: 12px;
    color: var(--text-color);

    padding-top: 4px;
    margin: 0;
}

.winner-icon {
    font-size: 18px;
    color: var(--text-color);
    opacity: .6;
    margin: 0;
}

.winner-time {
    font-size: 14px;
    line-height: 1.25;
    margin: 0;
}

.jersey-img {
    height: 32px;
    margin-top: 4px;
}

#video-links {
    margin: 4px 0 4px 0;
    line-height: 18px;
}

#video-links a {
    color: var(--text-color);
    text-decoration: none; /* Remove underline */
    transition: all 0.3s ease;
}

#video-links a:hover, #video-links a:focus {
    background-color: rgba(255, 237, 0, .9);
    color: #1A1B25;
    text-decoration: none; /* Remove underline */
}

.photo-links {
    margin: 4px 0 4px 0;
    line-height: 18px;
}

.photo-links a {
    color: var(--text-color);
    text-decoration: none; /* Remove underline */
    transition: all 0.3s ease;
}

.photo-links a:hover, #video-links a:focus {
    background-color: rgba(255, 237, 0, .9);
    color: #1A1B25;
    text-decoration: none; /* Remove underline */
}

/* Floating video player in the bottom right */
#video-player-container {
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 480px; /* Adjust width */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    user-select: none;
    transition: width 0.3s ease-in-out;
}

#video-player-container.expanded {
    width: min(960px, calc(100vw - 20px));
}

#video-player-container.dragging,
#photo-viewer-container.dragging {
    cursor: grabbing;
}

#video-player-container #video-player {
    pointer-events: auto;
    display: block;
}

#video-player-container #close-player {
    pointer-events: auto;
}

.viewer-drag-handle {
    position: absolute;
    top: 25%;
    left: 0;
    width: 32px;
    height: 50%;
    background: rgba(255, 255, 255, 0.05);
    cursor: move;
    z-index: 1001;
    border-radius: 0;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 237, 0, 1);
    touch-action: none;
}

.viewer-drag-handle .drag-icon {
    width: 8px;
    height: 12px;
}

#video-player-container:hover .video-player-drag-handle,
#photo-viewer-container:hover .photo-viewer-drag-handle {
    opacity: 1;
}

#video-player-container.dragging .video-player-drag-handle,
#photo-viewer-container.dragging .photo-viewer-drag-handle {
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.viewer-drag-handle:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Video element */
#video-player {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    display: block;
}

/* Hide the video player by default */
.hidden {
    display: none;
}

#photo-viewer-container {
    position: fixed;
    bottom: 10px;
    right: 10px;
    max-width: 480px;
    max-height: 100%;
    background: rgba(26, 27, 37, .9);
    border-radius: 8px;
    overflow: auto;
    object-fit: contain;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    transition: max-width 0.3s ease-in-out, max-height 0.3s ease-in-out;
}

#photo-viewer-container.expanded {
    max-width: 960px; /* Expanded width */
    max-height: 95%; /* Expanded height */
    object-fit: contain;
}

.photo-viewer {
    position: relative;
    width: 100%;
    max-height: auto;
    display: block;
}

#photo-viewer-image {
    width: 100%;
    height: auto;
    border-radius: 8px 8px 0 0;
}

#photo-viewer-caption {
    color: #fff;
    margin: 0 0 2px 0;
    font-size: 12px;
    text-align: center;
}

#expand-photo-viewer,
#expand-video-player {
    position: absolute;
    background-color: transparent;
    top: 4px;
    left: 4px;
    background: transparent;
    opacity: 0;
    color: #ffed00;
    cursor: pointer;
    border: none;
    border-radius: 50%; /* Make the button circular */
    width: 18px;
    height: 18px;
    z-index: 1100; /* Higher z-index to keep above video content */
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#expand-photo-icon,
#expand-video-icon {
    width: 18px;
    height: 18px;
}

#close-photo-viewer,
#close-player {
    position: absolute;
    top: 4px;
    right: 4px;
    background: transparent;
    opacity: 0;
    color: #ffed00;
    font-size: 18px;
    cursor: pointer;
    border: none;
    border-radius: 50%; /* Make the button circular */
    width: 28px;
    height: 24px;
    z-index: 1100; /* Higher z-index to keep above video content */
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hover functionality to show close and expand buttons */
#photo-viewer-container:hover #close-photo-viewer,
#photo-viewer-container:hover #expand-photo-viewer,
#video-player-container:hover #close-player,
#video-player-container:hover #expand-video-player {
    opacity: 1;
}

/* Add hover effect for better user experience */
#close-photo-viewer:hover,
#close-player:hover,
#expand-photo-viewer:hover,
#expand-video-player:hover {
    transform: scale(1.25);
}

/* Video and photo media grid inside the tooltip */
.media-grid {
    display: grid;
    grid-auto-flow: row;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 4px 0 0 0;
    justify-items: start; /* Aligns items to the left */
}

/* Media thumbnails (both video and photo) */
.media-thumbnail {
    position: relative;
    cursor: pointer;
    border-radius: 2px;
    overflow: visible;
    opacity: 1;
    filter: brightness(.9);
    transition: opacity 0.3s ease, filter 0.3s ease; /* Add opacity transition */
    width: 100%;
    aspect-ratio: 44 / 30;
}

.media-thumbnail img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover; /* Ensures the image covers the thumbnail area without stretching */
    border-radius: 2px;
}

/* Hover effect to adjust opacity */
.media-thumbnail:hover {
    filter: brightness(1.1);
    opacity: 1; /* Lower opacity on hover */
}

.media-thumbnail[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    background: rgba(26, 27, 37, 0.88);
    color: #ffffff;
    border-radius: 2px;
    padding: 3px 5px;
    font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
    font-size: 10px;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    width: max-content;
    max-width: 160px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -2px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 20;
}

.media-thumbnail[data-tooltip]:hover::after,
.media-thumbnail[data-tooltip]:focus::after,
.media-thumbnail[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Play button icon overlay on videos */
.video-thumbnail .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.6);
    padding: 5px 5px 5px 6px;
    border-radius: 50%;
    pointer-events: none;
}

/* The toggle switch */
.toggle-container {
    align-self: center;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 42px;  /* Full width of the switch (including 5px border on both sides) */
    height: 26px; /* Height of the switch (including 5px border on top and bottom) */
    -webkit-tap-highlight-color: transparent; /*Control the Default Touch Highlight: On touch devices, browsers provide a default highlight to indicate that an element is being tapped or activated.*/
}

/* Hide the default checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Custom tooltip styling */
.switch::before {
    content: 'Toggle scheme';
    position: absolute;
    bottom: -110%;
    left: -10%;
    background: var(--toggle-btn-background-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-top: 4px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity .3s ease;
}

.switch:hover::before {
    opacity: 1;
}

.switch-alt::before {
    content: 'Toggle scheme (new)';
}

.switch-bp::before {
    content: 'Toggle scheme';
}

/* The slider itself */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #1A1B25; /* Default background color */
    transition: background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
    border-radius: 26px; /* Fully rounded */
    border: 5px solid #ffffff; /* 5px border around the slider */
}

/* The circle inside the slider */
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 28px;
    left: 6px; /* Position adjusted due to the 5px border */
    top: 0;
    bottom: 0;
    background-color: white; /* Circle color */
    transition: transform 0.22s ease, width 0.22s ease, border-radius 0.22s ease, background-color 0.22s ease;
    border-radius: 26px;
}

/* When checked (dark mode), change background and move circle */
input:checked + .slider {
    background-color: #1A1B25; /* Dark mode background */
    border: 5px solid #1A1B25;
}

/* Change the circle's position and color on toggle */
input:checked + .slider:before {
    transform: translateX(8px); /* Circle will move to the right on toggle */
    width: 16px;
    height: 16px;
    background-color: white;
    left: 8px;
    top: 0;
    border-radius: 50%; /* Circle */
}

/* Hover effect for better interactivity */
.slider:hover {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); /* Slight glow effect on hover */
}

.switch input:focus-visible + .slider {
    box-shadow: 0 0 0 3px rgba(255, 237, 0, 0.55);
}

.slider-alt {
    background: #f2f2f2;
    border: 2px solid #c6c7cc;
}

.slider-alt:before {
    height: 18px;
    width: 18px;
    left: 3px;
    top: 2px;
    border-radius: 50%;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.switch-alt input:checked + .slider-alt {
    background: #101116;
    border-color: #101116;
}

.switch-alt input:checked + .slider-alt:before {
    transform: translateX(17px);
    left: 2px;
    top: 2px;
    width: 18px;
    height: 18px;
    background-color: #ffed00;
}

.switch-bp {
    width: 52px;
    height: 32px;
}

.slider-bp {
    background: #cbd5e1;
    border: 2px solid #94a3b8;
    border-radius: 999px;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.slider-bp:before {
    width: 24px;
    height: 24px;
    left: 3px;
    top: 2px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.slider-bp:after {
    content: "L";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 700;
    color: #334155;
    transition: color 0.2s ease, right 0.2s ease;
}

.switch-bp input:checked + .slider-bp {
    background: #0f172a;
    border: 2px solid #0f172a;
}

.switch-bp input:checked + .slider-bp:before {
    transform: translateX(20px);
    left: 3px;
    top: 2px;
    width: 24px;
    height: 24px;
    background: #ffed00;
}

.switch-bp input:checked + .slider-bp:after {
    content: "D";
    right: 34px;
    color: #f8fafc;
}

@media (prefers-reduced-motion: reduce) {
    body,
    .slider,
    .slider:before,
    .slider:after {
        transition: none;
    }
}

/* ----------------------------------------------------------------------------
   Theme toggle button (icon-only, sun/moon)
   Single circular button: shows sun in dark mode, moon in light mode.
   Reuses #dark-mode-toggle-bp checkbox so existing JS continues to work.
---------------------------------------------------------------------------- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
    border: 1.5px solid color-mix(in srgb, var(--text-color) 22%, transparent);
    color: var(--text-color);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle-btn input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.theme-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.theme-toggle-glyph {
    position: absolute;
    width: 20px;
    height: 20px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Light mode active (checkbox checked) -> show moon */
.theme-toggle-btn input:checked ~ .theme-toggle-icon .theme-toggle-sun {
    opacity: 0;
    transform: rotate(-45deg) scale(0.6);
}
.theme-toggle-btn input:checked ~ .theme-toggle-icon .theme-toggle-moon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Dark mode active (checkbox unchecked) -> show sun */
.theme-toggle-btn input:not(:checked) ~ .theme-toggle-icon .theme-toggle-sun {
    opacity: 1;
    transform: rotate(0) scale(1);
}
.theme-toggle-btn input:not(:checked) ~ .theme-toggle-icon .theme-toggle-moon {
    opacity: 0;
    transform: rotate(45deg) scale(0.6);
}

.theme-toggle-btn:hover {
    border-color: color-mix(in srgb, var(--text-color) 50%, transparent);
    background: color-mix(in srgb, var(--text-color) 6%, transparent);
}

.theme-toggle-btn input:focus-visible ~ .theme-toggle-icon {
    outline: 2px solid rgba(255, 237, 0, 0.7);
    outline-offset: 2px;
    border-radius: 50%;
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle-btn,
    .theme-toggle-glyph {
        transition: none;
    }
}

.tour-speeds {
    margin-left: 140px;
}

.speed-grid {
    display: grid;
    grid-template-columns: repeat(22, 20px);
    gap: 2px;
    margin-bottom: 20px;
}

.speed-cell {
    width: 20px;
    height: 20px;
    border-radius: 2px;
    position: relative;
}

.speed-legend {
    display: flex;
    gap: 20px;
    margin: 48px 0 0 188px;
}

.legend-item {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-red {
    background: #C30F19;
}

.legend-yellow {
    background: #FFED00;
}

.legend-green {
    background: #3BAA31;
}

.year-label {
    font-size: 14px;
    font-weight: 700;
    margin-right: 8px;
    display: flex;
    align-items: center;
}

.winner-label {
    font-size: 12px;
    font-weight: 400;
    margin-right: 12px;
    display: flex;
    align-items: center;
    min-width: 110px;
    color: var(--text-color);
    opacity: .9;
}

.avg-speed-label {
    font-size: 12px;
    font-weight: 400;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 50px;
    color: var(--text-color);
    opacity: 1;
}

.distance-label {
    font-size: 12px;
    font-weight: 400;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 60px;
    color: var(--text-color);
    opacity: .5;
}

.year-label a {
    color: var(--text-color);
    padding: 4px;
    position: relative;
    transition: all 0.3s ease;
    text-decoration: none;
}

.year-label a:hover {
    color: #1a1b25;
    background-color: rgba(255, 237, 0, .9); /* Optional: background color inside the box */
}

.year-label a.gated {
    opacity: 0.35;
    pointer-events: none;
}

.speed-grid-container {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
}


#speedGrid {
    margin: 0px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.speed-grid-header,
.speed-grid-row {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
}

.empty-label,
.year-label {
    width: 40px;
    padding-right: 10px;
    text-align: right;
}

.stage-header {
    width: 20px;
    text-align: center;
    font-size: 14px;
}

.speed-cell {
    width: 16px;
    height: 24px;
    border-radius: 2px;
    position: relative;
    background-color: transparent;
    cursor: pointer;
}

.speed-cell svg {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.speed-cell-active {
    background-color: rgba(0, 0, 0, 0.08);
    border-radius: 2px;
}

.dark-mode .speed-cell-active {
    background-color: rgba(255, 255, 255, 0.12);
}

.stages-container {
    display: flex;
    gap: 2px;
}

/* Text modal styles */
#textModal {
    display: none;
    position: fixed;
    z-index: 900;
    pointer-events: none; /* Allow clicking through the overlay */
}

#textModal .modal-content {
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 440px;
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--tooltip-background-color);
    border-radius: 8px;
    box-shadow: var(--tooltip-box-shadow);
    pointer-events: auto; /* Re-enable clicking on the modal itself */
}

#textModal .close-text-modal {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    opacity: 0;
    color: #ffed00;
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    z-index: 1100;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#textModal:hover .close-text-modal {
    opacity: 1;
}

#textModal .close-text-modal:hover {
    transform: scale(1.25);
}

#textContent {
    white-space: pre-wrap;
    font-family: 'Euclid Circular A', monospace;
    font-size: 14px;
    margin-top: 20px;
    color: var(--text-color);
}

#textContent a {
    color: inherit;
    text-decoration: underline;
    transition: background-color 0.2s ease;
}

#textContent a:hover,
#textContent a:focus {
    background-color: #ffed00;
    color: #1a1b25;
}

#textTitle {
    color: var(--text-color);
    font-size: 16px;
    margin: 0 0 10px 0;
}

/* Intro actions: Hide Winners button + Legend (keyboard) button */
.intro-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Shared circle button for shortcuts (keyboard) and legend (?) triggers */
.overlay-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    font-family: inherit;
    color: var(--text-color);
    background: transparent;
    border: 1.5px solid color-mix(in srgb, var(--text-color) 22%, transparent);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.overlay-trigger::before {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--tooltip-background-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-top: 4px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 300;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}
.overlay-trigger:hover::before,
.overlay-trigger:focus::before {
    opacity: 1;
}
.overlay-trigger:hover {
    border-color: color-mix(in srgb, var(--text-color) 50%, transparent);
    background: color-mix(in srgb, var(--text-color) 6%, transparent);
}
.overlay-trigger:focus-visible {
    outline: 2px solid rgba(255, 237, 0, 0.7);
    outline-offset: 2px;
}
.shortcuts-trigger::before {
    content: 'Shortcuts';
}
.legend-trigger::before {
    content: 'Legend';
}
/* Reusable keyboard icon: single source of truth is assets/icons/keyboard.svg */
.icon-keyboard {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: currentColor;
    mask: url('../assets/icons/keyboard.svg') center / contain no-repeat;
    -webkit-mask: url('../assets/icons/keyboard.svg') center / contain no-repeat;
}
.overlay-trigger .icon-keyboard {
    pointer-events: none;
}
.legend-trigger-icon {
    width: 20px;
    height: 20px;
    pointer-events: none;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
}
.overlay-trigger:hover .legend-trigger-icon,
.overlay-trigger:focus .legend-trigger-icon {
    color: currentColor;
}

/* Legend overlay (full-screen) */

.legend-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}
.legend-overlay.hidden {
    display: none;
}
.legend-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}
.legend-overlay-content {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--background-color);
    color: var(--text-color);
    border-radius: 8px;
    padding: 2rem 2rem 2rem 2rem;
    font-size: 0.82em;
    font-weight: 300;
    font-family: 'Euclid Circular A', Arial, sans-serif;
}
.legend-overlay-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    color: #ffed00;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.legend-overlay-close:hover {
    opacity: 0.8;
    transform: scale(1.1);
}
.legend-overlay-title {
    margin: 12px 2.5rem 24px 0;
    font-size: 1.5em;
    font-weight: 600;
}
.legend-overlay-body {
    margin: 0;
    line-height: 1.6;
}
.legend-jerseys {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.legend-jerseys .legend-item {
    margin-bottom: 0;
}
.legend-jerseys .legend-jersey-icon {
    flex-shrink: 0;
    height: 32px;
    width: auto;
    object-fit: contain;
}
.legend-section {
    margin-bottom: 1.5rem;
}
.legend-section:last-child {
    margin-bottom: 0;
}
.legend-section h3 {
    margin: 0 0 12px 0;
    font-size: 1.2em;
    font-weight: 600;
}
.legend-other-intro {
    margin: 0 0 0.75rem 0;
    font-size: 14px;
}
.legend-other-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.legend-other-item.legend-item {
    align-items: flex-start;
}
.legend-other-thumb-wrap {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}
.legend-other-thumb {
    display: block;
    width: 48px;
    height: 27px;
    object-fit: cover;
    border-radius: 4px;
}
/* Play button overlay on video thumb in legend */
.legend-other-thumb-wrap.video-thumbnail .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: #fff;
    background: rgba(0, 0, 0, 0.65);
    padding: 3px 3px 3px 4px;
    border-radius: 50%;
    line-height: 1;
}
/* Text thumbnail in legend: same doc-icon as start milestones */
.legend-other-thumb-wrap.text-thumbnail .doc-icon {
    font-size: 18px;
}
.legend-items {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 12px;
}
.legend-item:last-child {
    margin-bottom: 0;
}
.legend-item-has-desc {
    align-items: flex-start;
}
.legend-item-label {
    font-weight: 600;
}
.legend-item-content {
    display: block;
}
.legend-item-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.legend-milestone-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    object-fit: contain;
}
/* Move / lead-change icons: radiating circle with animation in legend */
.legend-radiating-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}
.legend-overlay .legend-radiating-wrap .radiating-circle {
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -4px;
    margin-top: -4px;
}
/* Larger key indicators in legend overlay for readability */
.legend-overlay .txtnav {
    font-size: 1em;
    padding: 4px 6px;
    min-width: 20px;
}
.legend-overlay .txtnav-modifier {
    font-size: 1.05em;
    padding: 4px 6px;
}
.legend-note {
    margin: 0;
    font-size: inherit;
    line-height: 1.6;
    color: var(--text-color);
    opacity: 0.85;
}
.legend-doping-note {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
}

/* Text thumbnail styles */
.text-thumbnail {
    position: relative;
    cursor: pointer;
}

.text-thumbnail .doc-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: white;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

.text-source {
    color: var(--text-color);
    position: relative;
    margin-top: 10px;
    font-size: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.text-source a {
    color: var(--text-color);
    position: relative;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.text-source a:hover, 
.text-source a:focus {
    color: #1a1b25;
    background-color: rgba(255, 237, 0, .9);
}

/* Featured Riders Section */
.featured-riders-section {
    margin-bottom: 40px;
}

.featured-riders-carousel {
    position: relative;
    width: 420px;
    height: 300px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
}

.featured-riders-content {
    display: flex;
    transition: transform 0.3s ease-in-out;
    height: 100%;
    gap: 4px;
}

.featured-riders-slide {
    min-width: calc(50% - 10px);
    position: relative;
}

.featured-riders-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-riders-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
}

.featured-riders-text h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
}

.featured-riders-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.featured-riders-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    z-index: 2;
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.2s;
    opacity: 1;
    visibility: visible;
}

.featured-riders-arrow:hover {
    background: rgba(255, 255, 255, 0.9);
}

.featured-riders-prev {
    left: 10px;
}

.featured-riders-next {
    right: 10px;
}

.featured-riders-arrow.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Dark mode support for featured riders */
.dark-mode .featured-riders-arrow {
    background: rgba(26, 27, 37, 0.8);
    color: white;
}

.dark-mode .featured-riders-arrow:hover {
    background: rgba(26, 27, 37, 0.9);
}

/* Historic Climbs Section */
.historic-climbs-section {
    margin-bottom: 40px;
}

.historic-climbs-carousel {
    position: relative;
    width: 540px;
    height: 400px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
}

.historic-climbs-content {
    display: flex;
    transition: transform 0.3s ease-in-out;
    height: 100%;
    gap: 4px;
}

.historic-climbs-slide {
    min-width: calc(50% - 10px);
    position: relative;
}

.historic-climbs-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.historic-climbs-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
}

.historic-climbs-text h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
}

.historic-climbs-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.historic-climbs-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    z-index: 2;
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.2s;
    opacity: 1;
    visibility: visible;
}

.historic-climbs-arrow:hover {
    background: rgba(255, 255, 255, 0.9);
}

.historic-climbs-prev {
    left: 10px;
}

.historic-climbs-next {
    right: 10px;
}

.historic-climbs-arrow.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Dark mode support for historic climbs */
.dark-mode .historic-climbs-arrow {
    background: rgba(26, 27, 37, 0.8);
    color: white;
}

.dark-mode .historic-climbs-arrow:hover {
    background: rgba(26, 27, 37, 0.9);
}

.intro-section {
    display: flex;
    gap: 4rem;
    margin: 0 0 0 140px;
    padding: 0;
    width: fit-content; /* prevent container from forcing child resize */
}

.tour-intro {
    flex: 1;
    min-width: 0; /* Prevents text from overflowing */
}

.tour-map {
    flex: 0 0 auto;
    max-width: 400px;
    align-self: flex-start;
}

.tour-map img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    transition: filter 0.2s ease;
}

.tour-map a:hover img {
    filter: brightness(1.05);
}

@media (max-width: 600px) {
    .toggle-container {
        margin: 0;
    }

    .tour-logo {
    margin: 48px 0 24px 24px;
    }

    .top-year-selector {
        gap: 8px;
    }

    .milestone {
        min-width: 24px;
        min-height: 24px;
    }

    .intro-section {
        margin: 0 0 0 24px !important;
    }

    .tour-intro {
        flex: 1 1 auto;
    }

    .tour-winners-container {
        padding: 0 16px;
    }

    .tour-winners {
        grid-template-columns: 1fr;
        gap: 16px;
        margin: 0 auto;
        justify-content: center;
        max-width: 260px;
    }

    .tour-winners-title {
        margin: 88px 0 20px;
        text-align: center;
    }


    #video-player-container {
        width: 100%;  /* Make the video player take the full width of the mobile screen */
        max-width: 100%; /* Ensure it doesn't exceed the screen width */
        bottom: 0; /* Keep it at the bottom */
        left: 0;
    }

    #video-player-container.expanded {
        width: 100%;
    }

    .bottom-year-selector {

        gap: 15px;
        padding: 15px;
        max-width: 300px;
        margin: 20px auto;
    }

    .year-nav-btn {
        min-width: 40px;
        height: 40px;
        padding: 4px 12px;
        font-size: 20px;
    }

    .bottom-dropdown-toggle {
        padding: 4px 12px;
        font-size: 32px;
    }
}

@media (max-width: 1024px) {
    .intro-section {
        flex-direction: column;
    }
    
    .tour-map {
        max-width: 420px;
    }
}

/* Speed tooltip styles */
.speed-tooltip {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    color: var(--text-color);
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.speed-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #ffffff;
}

.speed-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.15);
}

.dark-mode .speed-tooltip {
    background: #1A1B25;
    border-color: rgba(255, 255, 255, 0.15);
}

.dark-mode .speed-tooltip::after {
    border-top-color: #1A1B25;
}

.dark-mode .speed-tooltip::before {
    border-top-color: rgba(255, 255, 255, 0.15);
}

.speed-tooltip-link {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.speed-tooltip-meta {
    font-size: 11px;
    opacity: 0.6;
}

.speed-tooltip-winner {
    font-size: 14px;
    font-weight: 600;
}

.speed-tooltip-speed {
    font-size: 11px;
    font-weight: 600;
}

/* Bottom Year Selector Styles */
.bottom-year-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0 0;
    padding: 20px;
    background: transparent;
    border-radius: 12px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.year-nav-btn {
    background: var(--background-color);
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    transition: background .3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 48px;
    font-size: 24px;
    color: #ffed00;
}

.year-nav-btn:hover {
    background: var(--toggle-btn-background-color);
    outline: none;
}

.year-nav-btn:active {
    transform: none;
}

.year-nav-btn:disabled {

    cursor: not-allowed;
    transform: none;
    color: var(--toggle-btn-background-color);
}

.year-nav-btn:disabled:hover {
    background: var(--background-color);
    color: var(--toggle-btn-background-color);
    transform: none;
}

.bottom-dropdown {
    position: relative;
    min-width: 120px;
}

.bottom-dropdown-toggle {
    position: relative;
    font-family: 'Euclid Circular A', sans-serif;
    padding: 4px 12px;
    font-size: 40px;
    font-weight: 700;
    border-radius: 4px;
    border: none;
    background: var(--background-color);
    color: #ffed00;
    cursor: pointer;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    transition: background .3s ease;
    width: 100%;
}

.bottom-dropdown-toggle::before {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--tooltip-background-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-top: 4px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 300;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.bottom-dropdown-toggle:hover::before,
.bottom-dropdown-toggle:focus::before {
    opacity: 1;
}

.bottom-dropdown-toggle:hover {
    outline: none;
    background: var(--toggle-btn-background-color);
    transform: none;
}

.bottom-dropdown-toggle.active {
    background: var(--toggle-btn-background-color);
    color: #ffed00;
    transform: none;
}

.bottom-dropdown-arrow {
    width: 16px;
    height: 16px;
    margin-left: 12px;
    transform: rotate(180deg);
    transition: transform 0.2s ease;
}

.bottom-dropdown-toggle.active .bottom-dropdown-arrow {
    transform: rotate(0deg);
}

.bottom-dropdown-menu {
    position: absolute;
    max-height: 320px;
    overflow-y: auto;
    scrollbar-width: thin;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--toggle-btn-background-color);
    box-shadow: var(--tooltip-box-shadow);
    border: 1px solid var(--rider-background-color);
    border-radius: 4px;
    margin-top: 4px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.bottom-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bottom-dropdown-item {
    padding: 4px 8px;
    margin: 2px 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    border-bottom: none;
}

.bottom-dropdown-item:last-child {
    border-bottom: none;
}

.bottom-dropdown-item:hover {
    background: var(--rider-background-color);
    color: var(--text-color);
    border-radius: 4px;    
    outline: none;
    text-decoration: none;
}

.bottom-dropdown-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.bottom-dropdown-item.gated {
    opacity: 0.35;
    pointer-events: none;
}

.bottom-dropdown-item.disabled:hover {
    background: transparent;
}

/* Home page specific styles */
.home-intro {
    width: 420px;
    min-width: 420px;
    max-width: 420px;
    flex: 0 0 420px;
    flex-shrink: 0;
    font-size: .82em;
    font-weight: 300;
    margin: 0;
}

.home-intro h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0px 0 14px 0;
}

.home-intro p {
    margin: 0 0 12px 0;
    line-height: 1.6;
}

.home-intro p:last-of-type {
    margin-bottom: 18px;
}

.home-intro blockquote {
    font-size: 14px;
    font-weight: 200;
    margin: 12px 0;
    padding-left: 24px;
    border-left: 3px solid currentColor;
    border-color: var(--text-color);
}

.home-intro h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 4px 0;
}

.home-intro h2:first-of-type {
    font-size: 32px;
    margin: 2px 0;
}

.home-intro a {
    color: var(--text-color);
    position: relative;
    transition: all 0.3s ease;
}

.home-intro a:hover, .home-intro a:focus {
    color: #1a1b25;
    background-color: rgba(255, 237, 0, .9);
}

.intro-section {
    margin-top: 36px;
}

.speed-legend {
    text-align: center;
    font-size: 12px;
}

.speed-header {
    font-weight: 600;
    font-size: 11px;
    opacity: 0.7;
    text-align: center;
}

.stages-container.speed-header {
    text-align: left;
}


.winner-label.speed-header {
    text-align: left;
}

/* Home page content alignment */
body.home-page .intro-section {
    margin: 36px auto 12px auto;
    max-width: 1052px;
    width: min(1052px, calc(100% - 32px));
}

body.home-page .home-intro {
    width: min(100%, 620px);
    min-width: 0;
    max-width: 58ch;
    flex: initial;
}

body.home-page .home-hero {
    position: relative;
    margin: 72px auto 24px auto;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: visible;
}

body.home-page .home-hero-lead-change-wrap {
    /* Visible state after fade-in (was ~0.42; higher reads clearly on the hero) */
    --hero-lc-opacity: 0.92;
    position: absolute;
    top: 15%;
    left: 85%;
    z-index: 2;
    pointer-events: none;
    /* Only translate here — scaling the whole wrap made the tooltip ~2.75× larger than year-page tooltips */
    transform: translate(-50%, -50%);
    transform-origin: center center;
    opacity: var(--hero-lc-opacity);
    transition: opacity 0.8s ease;
}

/* No extra scale — match normal milestone lead-change dot size (8px + rings) */
body.home-page .home-hero-blinker-scale {
    display: inline-block;
    transform: none;
    transform-origin: center center;
}

body.home-page .home-hero-lead-change-wrap.is-hidden {
    opacity: 0;
}

body.home-page .home-hero-lead-change-wrap .radiating-circle {
    position: relative;
    display: block;
}

body.home-page .home-hero-lead-change-wrap .radiating-circle.lead-change::before,
body.home-page .home-hero-lead-change-wrap .radiating-circle.lead-change::after {
    inset: -12px;
    animation: homeHeroLeadChangeRing 1.8s infinite;
}

body.home-page .home-hero-lead-change-wrap .radiating-circle.lead-change::after {
    inset: -26px;
    animation-delay: 0.4s;
}

html.dark-mode body.home-page .home-hero-lead-change-wrap {
    --hero-lc-opacity: 0.88;
}

body.home-page .home-hero .home-intro {
    position: relative;
    z-index: 1;
    max-width: 760px;
}

body.home-page .home-hero-milestone-tooltip {
    position: absolute;
    left: 50%;
    top: -22px;
    transform: translate(-50%, -100%) scale(0.45);
    z-index: 10;

    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;

    width: max-content;
    max-width: 320px;
    padding: 8px 10px;
    background: var(--tooltip-background-color);
    color: var(--text-color);
    border-radius: 12px;
    border-bottom: 4px solid #FBAD28;
    box-shadow: var(--tooltip-box-shadow);

    text-align: left;

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.55s cubic-bezier(0.34, 1.02, 0.68, 1),
        visibility 0.5s ease;
    pointer-events: none;
}

body.home-page .home-hero-milestone-tooltip .home-hero-milestone-rider {
    width: 32px;
    height: 32px;
    margin: 0;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 50%;
}

body.home-page .home-hero-milestone-tooltip-text {
    /* Slightly larger, emphasized callout text */
    font-size: 16px;
    font-weight: 700;
    font-style: italic;
    line-height: 1.2;
    letter-spacing: 0;
    white-space: nowrap;
}

body.home-page .home-hero-lead-change-wrap:not(.is-hidden) .home-hero-milestone-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -100%) scale(1);
}

html.dark-mode body.home-page .home-hero-milestone-tooltip {
    /* Keep the same orange border-bottom, but let the tooltip background follow dark mode */
    border-bottom-color: #FBAD28;
}

@media (max-width: 768px) {
    /* Hide the randomly-positioned lead-change blip + tooltip on mobile.
       Its absolute positioning + tooltip width caused off-screen overflow. */
    body.home-page .home-hero-lead-change-wrap {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.home-page .home-hero-lead-change-wrap {
        animation: none;
    }

    body.home-page .home-hero-lead-change-wrap .radiating-circle,
    body.home-page .home-hero-lead-change-wrap .radiating-circle.lead-change::before,
    body.home-page .home-hero-lead-change-wrap .radiating-circle.lead-change::after {
        animation: none;
    }
}

body.home-page .home-kicker {
    display: inline-block;
    margin: 0 0 28px 0;
    padding: 10px 20px;
    border: 1px solid rgba(212, 160, 23, 0.4);
    border-radius: 999px;
    color: #D4A017;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

body.home-page .home-kicker a {
    color: inherit;
    text-decoration: none;
}

body.home-page .home-kicker a:hover,
body.home-page .home-kicker a:focus {
    text-decoration: underline;
    text-underline-offset: 2px;
}

body.home-page .home-intro h1 {
    margin: 0 0 28px 0;
}

body.home-page .home-heading-main {
    display: block;
    font-size: clamp(46px, 7.6vw, 78px);
    line-height: 1.04;
    font-weight: 700;
    letter-spacing: -0.03em;
}

body.home-page .home-heading-accent {
    display: block;
    margin-top: 8px;
    font-family: 'Euclid Circular A', Arial, sans-serif;
    font-size: clamp(48px, 8.1vw, 86px);
    line-height: 1.02;
    letter-spacing: -0.02em;
    font-style: italic;
    font-weight: 300;
    color: #384358;
}

html.dark-mode body.home-page .home-heading-accent {
    color: #b6c2db;
}

body.home-page .home-hero .home-intro p:last-of-type {
    margin: 0 auto;
    max-width: 56ch;
    font-size: clamp(1.1rem, 2.2vw, 1.45rem);
    line-height: 1.55;
    color: color-mix(in srgb, var(--text-color) 74%, transparent);
}

body.home-page .home-hero-cta {
    display: inline-block;
    position: relative;
    overflow: hidden;
    margin-top: 24px;
    padding: 12px 20px;
    border: 1px solid #FFED00;
    border-radius: 999px;
    background: #FFED00;
    color: #1A1B25;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 6px 18px rgba(255, 237, 0, 0.28);
    transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease, color 0.22s ease, border-color 0.22s ease;
}

body.home-page .home-hero-cta::after {
    content: "";
    position: absolute;
    top: 0;
    left: -140%;
    width: 120%;
    height: 100%;
    background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.42) 50%, transparent 100%);
    transition: left 0.45s ease;
    pointer-events: none;
}

body.home-page .home-hero-cta:hover,
body.home-page .home-hero-cta:focus {
    background: #ffe100;
    border-color: #ffe100;
    color: #1A1B25;
    box-shadow: 0 12px 28px rgba(255, 237, 0, 0.38);
}

body.home-page .home-hero-cta:hover::after,
body.home-page .home-hero-cta:focus::after {
    left: 120%;
}

body.home-page .tour-speeds-wrap {
    margin: 120px auto 0 auto;
    max-width: 1052px;
    width: min(1052px, calc(100% - 32px));
}

body.home-page .tour-speeds-header {
    position: absolute;
    top: 24px;
    left: 30px;
    transform: none;
    z-index: 2;
    text-align: left;
    margin: 0;
    padding: 0;
}

body.home-page .tour-speeds-header h2 {
    margin: 0 0 6px 0;
    font-size: clamp(1.12rem, 2.15vw, 1.48rem);
    font-weight: 600;
    letter-spacing: -0.015em;
}

body.home-page .tour-speeds-header p {
    margin: 0;
    font-size: 0.82rem;
    opacity: 0.72;
}

body.home-page .tour-speeds {
    margin: 0 auto;
    max-width: 1052px;
    width: min(1052px, calc(100% - 32px));
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 18px;
    background: color-mix(in srgb, var(--toggle-btn-background-color) 70%, var(--background-color) 30%);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-color) 8%, transparent);
    padding: 54px 28px 22px 28px;
    /* Top padding so first row tooltips (positioned above cells) are not clipped by overflow */
    padding-top: 110px;
    margin-top: 0;
}

body.home-page #speedGrid {
    min-width: max-content;
}

body.home-page .tour-speeds .speed-legend-scale {
    margin: 24px 0 0 314px;
    width: max-content;
    flex-wrap: nowrap;
}

body.home-page .tour-speeds .speed-legend-scale .legend-item {
    font-size: 10px;
    margin-bottom: 0;
    align-items: flex-end;
}

body.home-page .tour-speeds .speed-legend-types {
    margin: 12px 0 0 314px;
    width: max-content;
    flex-wrap: nowrap;
}

body.home-page .tour-speeds .speed-legend-types .legend-item {
    font-size: 10px;
    margin-bottom: 0;
    align-items: flex-end;
}

body.home-page .tour-speeds .speed-legend-types .legend-item svg {
    display: block;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}


body.home-page .inside-edition-section {
    margin: 96px auto 40px auto;
    max-width: 1052px;
    width: min(1052px, calc(100% - 32px));
    text-align: center;
}

body.home-page .inside-edition-header h2 {
    margin: 0 0 6px 0;
    font-size: clamp(2rem, 4.2vw, 3.2rem);
    font-weight: 700;
    letter-spacing: -0.025em;
}

body.home-page .inside-edition-header p {
    margin: 0;
    font-size: clamp(1rem, 1.9vw, 1.9rem);
    color: color-mix(in srgb, var(--text-color) 74%, transparent);
}

body.home-page .inside-edition-grid {
    margin-top: 56px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 44px;
}

body.home-page .inside-edition-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

body.home-page .inside-edition-icon-wrap {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 237, 0, 0.24);
    color: #d4b300;
}

body.home-page .inside-edition-icon {
    width: 34px;
    height: 34px;
}

body.home-page .inside-edition-card h3 {
    margin: 0;
    font-size: clamp(1.35rem, 2vw, 1.9rem);
    font-weight: 700;
    letter-spacing: -0.015em;
}

body.home-page .inside-edition-card p {
    margin: 0;
    max-width: 32ch;
    font-size: 1.04rem;
    line-height: 1.55;
    color: color-mix(in srgb, var(--text-color) 74%, transparent);
}

html.dark-mode body.home-page .inside-edition-icon-wrap {
    background: rgba(255, 237, 0, 0.12);
    color: #ffed00;
}

body.home-page .inside-edition-cards-section {
    margin: 136px auto 84px auto;
    max-width: 1052px;
    width: min(1052px, calc(100% - 32px));
    text-align: center;
}

body.home-page .inside-edition-cards-grid {
    margin-top: 44px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

body.home-page .inside-edition-image-card {
    overflow: hidden;
    border-radius: 14px;
    text-align: left;
    background: color-mix(in srgb, var(--toggle-btn-background-color) 65%, var(--background-color) 35%);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-color) 10%, transparent);
}

body.home-page .inside-edition-image-card img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    display: block;
}

body.home-page .inside-edition-image-card-body {
    padding: 18px 18px 20px;
}

body.home-page .inside-edition-image-card h3 {
    margin: 0 0 8px 0;
    font-size: clamp(1.1rem, 1.6vw, 1.3rem);
    font-weight: 700;
    letter-spacing: -0.01em;
}

body.home-page .inside-edition-image-card p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: color-mix(in srgb, var(--text-color) 74%, transparent);
}

body.home-page .access-collection-section {
    margin: 132px auto 56px auto;
    max-width: 1052px;
    width: min(1052px, calc(100% - 32px));
}

body.home-page .access-collection-header {
    text-align: center;
}

body.home-page .access-collection-header h2 {
    margin: 0 0 10px 0;
    font-size: clamp(2rem, 3.9vw, 3.25rem);
    letter-spacing: -0.02em;
}

body.home-page .access-collection-header p {
    margin: 0 auto;
    max-width: 62ch;
    font-size: clamp(1rem, 1.6vw, 1.65rem);
    line-height: 1.45;
    color: color-mix(in srgb, var(--text-color) 72%, transparent);
}

body.home-page .access-plan-switcher {
    margin: 52px auto 0 auto;
    width: min(640px, 100%);
    position: relative;
}

body.home-page .access-plan-card {
    position: relative;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--text-color) 10%, transparent);
    background: color-mix(in srgb, var(--toggle-btn-background-color) 62%, var(--background-color) 38%);
    padding: 54px 30px 28px;
}

body.home-page .access-plan-switcher input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

body.home-page .access-plan-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: fit-content;
    margin: 0;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    border: 1px solid color-mix(in srgb, var(--text-color) 14%, transparent);
    border-radius: 999px;
    overflow: hidden;
    background: color-mix(in srgb, var(--toggle-btn-background-color) 72%, var(--background-color) 28%);
}

body.home-page .access-plan-toggle-btn {
    padding: 10px 20px;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--text-color) 64%, transparent);
    cursor: pointer;
}

body.home-page #access-plan-annual:checked ~ .access-plan-toggle label[for="access-plan-annual"],
body.home-page #access-plan-monthly:checked ~ .access-plan-toggle label[for="access-plan-monthly"] {
    background: #FFED00;
    color: #1A1B25;
}

body.home-page .access-plan-option {
    display: none;
}

body.home-page #access-plan-annual:checked ~ .access-plan-option-annual,
body.home-page #access-plan-monthly:checked ~ .access-plan-option-monthly {
    display: block;
}

body.home-page .access-plan-card h3 {
    margin: 0 0 18px 0;
    font-size: 1.08rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: color-mix(in srgb, var(--text-color) 65%, transparent);
}

body.home-page .access-plan-price {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

body.home-page .access-plan-sale-pill {
    margin: -6px 0 14px 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #D4A017;
}

body.home-page .access-plan-price-annual-sale {
    flex-wrap: wrap;
    align-items: flex-end;
}

body.home-page .access-plan-price-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-bottom: 2px;
}

body.home-page .access-plan-compare-at {
    font-size: clamp(0.95rem, 2.1vw, 1.12rem);
    font-weight: 600;
    line-height: 1.2;
    color: color-mix(in srgb, var(--text-color) 58%, transparent);
}

body.home-page .access-plan-compare-at s {
    text-decoration-thickness: 2px;
    margin-right: 6px;
}

body.home-page .access-plan-price .amount {
    font-size: clamp(3rem, 5.6vw, 4.7rem);
    line-height: 1;
    font-weight: 700;
    letter-spacing: -0.03em;
}

body.home-page .access-plan-price .period {
    font-size: clamp(1.35rem, 2.3vw, 2rem);
    line-height: 1.15;
    color: color-mix(in srgb, var(--text-color) 72%, transparent);
}

body.home-page .access-plan-note,
body.home-page .access-plan-savings {
    margin: 14px 0 24px 0;
    font-size: 1.06rem;
    line-height: 1.4;
}

body.home-page .access-plan-note {
    color: color-mix(in srgb, var(--text-color) 72%, transparent);
}

body.home-page .access-plan-savings {
    color: #D4A017;
    font-weight: 700;
}

body.home-page .access-plan-features {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

body.home-page .access-plan-features li {
    margin: 0;
    padding-left: 22px;
    position: relative;
}

body.home-page .access-plan-features li::before {
    content: "•";
    position: absolute;
    left: 0;
    top: 2px;
    color: #FFED00;
    font-size: 1.35rem;
    line-height: 1;
}

body.home-page .access-plan-features strong {
    display: block;
    font-size: 1.18rem;
}

body.home-page .access-plan-features span {
    display: block;
    margin-top: 4px;
    font-size: 1.03rem;
    line-height: 1.38;
    color: color-mix(in srgb, var(--text-color) 72%, transparent);
}

body.home-page .access-plan-cta {
    margin-top: 28px;
    width: 100%;
    border-radius: 0;
    padding: 15px 14px;
    font-family: inherit;
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    cursor: pointer;
}

body.home-page .access-plan-cta-outline {
    background: transparent;
    color: var(--text-color);
    border: 2px solid color-mix(in srgb, var(--text-color) 70%, transparent);
}

body.home-page .access-plan-cta-solid {
    background: #FFED00;
    color: #1A1B25;
    border: 2px solid #FFED00;
}

body.home-page .access-plan-option-annual {
    border-color: rgba(255, 237, 0, 0.7);
}

body.home-page .access-plan-option-annual h3 {
    color: #D4A017;
}

body.home-page .access-collection-footnote {
    margin: 16px auto 0 auto;
    text-align: center;
    font-size: 0.86rem;
    line-height: 1.45;
    color: color-mix(in srgb, var(--text-color) 62%, transparent);
}

body.home-page .access-collection-footnote a {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

body.home-page .access-collection-footnote a:hover,
body.home-page .access-collection-footnote a:focus {
    text-decoration: underline;
    text-underline-offset: 2px;
}

@media (max-width: 768px) {
    body.home-page .intro-section,
    body.home-page .tour-speeds {
        margin-left: 16px;
        margin-right: 16px;
        max-width: none;
        width: auto;
    }

    body.home-page .home-intro {
        max-width: none;
    }

    body.home-page .tour-speeds-wrap {
        margin-top: 64px;
        width: auto;
        max-width: none;
    }

    body.home-page .home-hero {
        margin-top: 48px;
    }

    body.home-page .home-kicker {
        margin-bottom: 20px;
        font-size: 0.82rem;
        padding: 8px 12px;
    }

    body.home-page .home-heading-main {
        font-size: clamp(38px, 12.5vw, 56px);
    }

    body.home-page .home-heading-accent {
        font-size: clamp(40px, 13.5vw, 62px);
    }

    body.home-page .home-hero-cta {
        margin-top: 20px;
        font-size: 0.82rem;
        padding: 10px 16px;
    }

    body.home-page .inside-edition-section {
        margin-top: 72px;
    }

    body.home-page .inside-edition-grid {
        grid-template-columns: 1fr;
        gap: 30px;
        margin-top: 42px;
    }

    body.home-page .inside-edition-card p {
        max-width: 38ch;
    }

    body.home-page .inside-edition-cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    body.home-page .inside-edition-image-card img {
        height: 210px;
    }

    body.home-page .access-plan-switcher {
        width: 100%;
    }

    body.home-page .access-plan-price .amount {
        font-size: clamp(2.5rem, 12vw, 3.8rem);
    }

    body.home-page .access-plan-price .period {
        font-size: clamp(1.1rem, 4.4vw, 1.55rem);
    }

    body.home-page .featured-riders-carousel,
    body.home-page .historic-climbs-carousel {
        width: 100%;
        max-width: 520px;
        height: 280px;
    }
}

@media (max-width: 600px) {
    body.home-page .intro-section {
        margin: 36px 16px 12px 16px;
    }

    /* Override global mobile intro left-offset rule to keep homepage hero centered */
    body.home-page .home-hero {
        margin-left: auto !important;
        margin-right: auto !important;
        justify-content: center;
    }

    body.home-page .tour-speeds {
        margin: 16px;
        border-radius: 14px;
        padding-top: 82px;
        padding-left: 16px;
        padding-right: 16px;
    }

    body.home-page .tour-speeds-header {
        top: 12px;
        left: 16px;
        width: calc(100% - 32px);
        padding: 0;
    }

    body.home-page .tour-speeds-wrap {
        margin: 56px 16px 0 16px;
        width: auto;
        max-width: none;
    }

    body.home-page .featured-riders-carousel,
    body.home-page .historic-climbs-carousel {
        height: 240px;
    }
}

.speed-cell-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 2px;
}

.speed-tooltip-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--rider-background-color);
    padding: 2px;
}

.speed-tooltip-icon {
    font-family: 'icons';
    margin-right: 4px;
    font-size: 14px;
}

.speed-tooltip-link {
    color: inherit;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

body.home-page .home-footer,
body.year-page .home-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
    margin: 64px auto 10px;
    width: min(1052px, calc(100% - 32px));
    text-align: center;
    color: var(--text-color);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

body.home-page .home-footer-logo-link,
body.year-page .home-footer-logo-link {
    display: block;
    line-height: 0;
    text-decoration: none;
    color: inherit;
}

body.home-page .home-footer-logo-link:focus-visible,
body.year-page .home-footer-logo-link:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--text-color) 55%, transparent);
    outline-offset: 4px;
    border-radius: 4px;
}

body.home-page .home-footer-logo,
body.year-page .home-footer-logo {
    width: auto;
    margin-top: -8px;
    height: 60px;
    display: block;
    opacity: 0.8;
}

body.home-page .home-footer-tagline,
body.year-page .home-footer-tagline {
    opacity: 0.45;
}

.home-footer-links {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    padding-bottom: 30px;
}

.home-footer-link {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-color);
    opacity: 0.4;
    text-decoration: none;
    text-transform: none;
    transition: opacity 0.15s;
}

.home-footer-link:hover {
    opacity: 0.7;
}

.home-footer-row {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
}

.footer-toggle-container {
    position: absolute;
    right: 0;
}

.footer-toggle-container .switch-bp::before {
    bottom: auto;
    top: calc(-100% - 16px);
    left: auto;
    right: 0;
    text-transform: none;
    letter-spacing: normal;
}

body.home-page .home-footer::before,
body.year-page .home-footer::before {
    content: "";
    display: block;
    width: min(420px, 100%);
    border-top: 1px solid currentColor;
    opacity: 0.35;
    margin-bottom: 8px;
}

/* Legal / static content (privacy policy, etc.) */
.legal-page-main {
    max-width: 640px;
    margin: 40px auto 0;
    padding: 0 20px 24px;
    width: min(640px, calc(100% - 32px));
}

.legal-page-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
}

.legal-page-updated {
    font-size: 15px;
    font-weight: 300;
    opacity: 0.6;
    margin: 0 0 24px;
    line-height: 1.5;
}

.legal-page-body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    font-weight: 300;
    line-height: 1.65;
    color: var(--text-color);
}

.legal-page-body h2 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 28px 0 10px;
}

.legal-page-body p {
    margin: 0 0 14px;
}

.legal-page-body ul {
    margin: 0 0 14px;
    padding-left: 22px;
}

.legal-page-body li {
    margin-bottom: 6px;
}

.legal-page-body strong {
    font-weight: 600;
}

.legal-page-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    padding: 2px 6px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--text-color) 8%, transparent);
}

.legal-page-body a {
    color: var(--text-color);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--text-color) 35%, transparent);
    text-underline-offset: 3px;
}

.legal-page-body a:hover {
    text-decoration-color: var(--text-color);
}

.home-footer.legal-page-footer {
    margin-top: 40px;
}

/* Official year-page layout */
body.year-page {
    padding-bottom: 72px;
}

body.home-page {
    padding-bottom: 72px;
}

body.year-page .tour-logo {
    margin: 0 auto;
    position: static;
    min-height: 64px;
    max-width: 1052px;
    width: min(1052px, calc(100% - 32px));
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-start;
}

body.year-page .logo-year-group {
    position: static;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

body.year-page .top-year-selector {
    order: 1;
    margin-right: 0;
    z-index: 2;
    max-width: none;
}

body.year-page .top-year-selector .custom-dropdown {
    min-width: 0;
}

body.year-page .logo-year-group > a {
    order: 2;
    flex: 0 0 auto;
}

body.year-page #tdf-logo {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    margin-right: 0;
}

body.year-page .toggle-container {
    order: 3;
    margin-left: auto;
}

body.year-page .switch::before {
    top: calc(100% + 6px);
    left: auto;
    right: 0;
    margin-top: 0;
    z-index: 1200;
}

@media (min-width: 769px) {
    body.year-page .tour-logo {
        position: relative;
        justify-content: space-between;
    }

    body.year-page .logo-year-group {
        gap: 0;
    }

    body.year-page .top-year-selector {
        margin-right: auto;
        max-width: calc(50% - 56px);
    }

    body.year-page #tdf-logo {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    body.year-page .toggle-container {
        margin-left: 0;
    }
}

body.year-page .intro-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    align-items: start;
    gap: clamp(24px, 4vw, 56px);
    margin: 36px auto 12px auto;
    max-width: 1052px;
    width: min(1052px, calc(100% - 32px));
}

body.year-page .tour-intro {
    width: auto;
    min-width: 0;
    max-width: 53ch;
    flex: initial;
}

body.year-page .tour-intro p {
    font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    margin: 0 0 12px 0;
}

body.year-page .tour-intro p.drop-cap-intro::first-letter {
    float: left;
    font-size: 6.2em;
    line-height: 0.8;
    font-weight: 600;
    margin-right: 0.08em;
    margin-top: 0.02em;
    color: var(--text-color);
}

body.year-page .tour-intro h3 {
    margin: 0 0 12px 0;
}

body.year-page .tour-map {
    width: 100%;
    max-width: none;
}

body.year-page .tour-map a {
    display: block;
    padding: 8px;
    border-radius: 12px;
    background: var(--toggle-btn-background-color);
}

body.year-page .tour-map img {
    display: block;
    border-radius: 8px;
}

@media (max-width: 1052px) {
    body.year-page .intro-section {
        grid-template-columns: 1fr;
        gap: 16px;
        justify-items: center;
    }

    body.year-page .tour-intro {
        width: 100%;
    }

    body.year-page .tour-map {
        width: 100%;
        max-width: 420px;
        justify-self: center;
    }
}

@media (max-width: 768px) {
    html {
        overflow-x: hidden;
    }

    body {
        padding-bottom: 120px;
    }

    body.year-page .tour-logo {
        margin: 16px 16px 14px 16px;
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "logo auth"
            "year year";
        column-gap: 8px;
        row-gap: 8px;
        align-items: center;
        min-height: auto;
    }

    body.year-page .logo-year-group {
        display: contents;
    }

    body.year-page .logo-year-group > a {
        grid-area: logo;
        justify-self: start;
    }

    body.year-page #tdf-logo {
        position: static;
        left: auto;
        top: auto;
        transform: none;
        width: clamp(64px, 16vw, 86px);
        margin-right: 0;
    }

    body.year-page .top-year-selector {
        grid-area: year;
        justify-self: start;
        order: 0;
        width: auto;
        max-width: 100%;
        min-width: 0;
        margin-right: 0;
        gap: 6px;
        flex-wrap: nowrap;
    }

    body.year-page .top-year-selector .custom-dropdown {
        min-width: 0;
    }

    body.year-page #auth-header {
        grid-area: auth;
        justify-self: end;
    }

    body.year-page .toggle-container {
        order: 3;
        margin: 0 0 0 auto;
    }

    body.year-page .intro-section {
        gap: 16px;
        margin: 36px 20px 12px 20px;
        width: min(1052px, calc(100% - 40px));
    }

    body.year-page .tour-intro {
        max-width: none;
    }

    body.year-page .tour-intro h3 {
        font-size: 0.94em;
        gap: 8px 10px;
        overflow-wrap: break-word;
    }

    body.year-page .tour-intro .avg-speed {
        margin-left: 0;
    }

    body.year-page .tour-intro p {
        font-size: 0.95em;
        overflow-wrap: break-word;
    }

    .legend-overlay {
        padding: 2.5rem 1rem;
    }
    .legend-overlay-content {
        font-size: 0.95em;
        max-height: 80vh;
        padding: 1.5rem 1.25rem 2rem;
    }

    body.year-page .tour-map {
        width: 100%;
        max-width: none;
    }

    body.year-page .tour-map a {
        padding: 6px;
    }

    body.year-page #stages-container {
        padding-right: 16px;
    }

    body.year-page .stage-layout {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        margin: 56px 0;
    }

    body.year-page .stage-viewport {
        width: 100%;
        overflow: visible;
        height: 286px;
        position: relative;
        z-index: 20;
    }

    body.year-page .stage-container {
        overflow: visible;
        width: 100%;
        height: 286px;
        position: relative;
        z-index: 20;
    }

    body.year-page .stage-number {
        position: absolute;
        top: 100%;
        right: 24px;
        left: auto;
        margin: 16px 0 0;
        width: auto;
        font-size: 52px;
        line-height: 1;
        justify-content: flex-end;
        align-self: auto;
        text-align: right;
        z-index: 2;
    }

    body.year-page .stage-profile {
        margin-left: 24px;
        min-width: 0;
        width: calc(100% - 24px);
    }

    body.year-page .stage-profile img {
        display: block;
        width: 100%;
        height: auto;
        max-width: 100%;
    }

    body.year-page .stage-winner,
    body.year-page .gc-table-section {
        margin: 16px 24px 0;
        align-self: flex-start;
        position: relative;
        z-index: 1;
    }

    body.year-page .stage-winner {
        flex-direction: row;
        justify-content: flex-start;
        gap: 10px;
        width: auto;
        text-align: left;
    }

    body.year-page .stage-winner .winner-img {
        margin-bottom: 0;
    }

    body.year-page .stage-winner .winner-details {
        align-items: flex-start;
    }

    body.year-page .stage-winner .winner-name {
        justify-content: flex-start;
    }

    body.year-page .gc-table-section {
        align-self: stretch;
    }

    body.year-page .gc-table-section .gc-table {
        width: 100%;
    }

    .tooltip-start,
    .tooltip-move,
    .tooltip-crash,
    .tooltip-mountain03,
    .tooltip-mountain03-bonus,
    .tooltip-mountain02,
    .tooltip-mountain02-bonus,
    .tooltip-mountain01,
    .tooltip-mountain01-bonus,
    .tooltip-mountainHc,
    .tooltip-mountainHc-bonus,
    .tooltip-sprint,
    .tooltip-sprint-bonus,
    .tooltip-finish,
    .tooltip-finish-bonus,
    .tooltip-finish-03,
    .tooltip-finish-02,
    .tooltip-finish-01,
    .tooltip-finish-Hc {
        width: min(260px, calc(100vw - 48px));
        max-width: calc(100vw - 48px);
    }

    .tooltip-content,
    .tooltip-start .tooltip-content {
        min-width: 0;
    }
}

@media (max-width: 480px) {
    body.year-page .dropdown-toggle {
        font-size: 28px;
    }

    body.year-page #year-select {
        width: 78px;
    }

    body.year-page .stage-layout {
        margin: 44px 0;
    }

    body.year-page .stage-profile {
        margin-left: 16px;
        width: calc(100% - 16px);
    }

    .gc-table,
    .winners-table {
        max-width: calc(100vw - 48px);
        width: auto;
    }
}


.speed-header {
    font-weight: 600;
    font-size: 11px;
    opacity: 0.7;
    text-align: center;
}

.speed-cell-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 2px;
}

.speed-tooltip-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--rider-background-color);
    padding: 2px;
}

.speed-tooltip-icon {
    font-family: 'icons';
    margin-right: 4px;
    font-size: 14px;
}

.speed-tooltip-link {
    color: inherit;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* ============================================================================
   SEARCH OVERLAY
   ============================================================================ */

.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 1rem 1rem;
    box-sizing: border-box;
}

.search-overlay.hidden {
    display: none;
}

.search-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    cursor: pointer;
}

.search-overlay-content {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: var(--background-color);
    color: var(--text-color);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
    font-family: 'Euclid Circular A', Arial, sans-serif;
}


.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.9rem 1rem 0.9rem 1.1rem;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
    flex-shrink: 0;
}

.search-input-icon {
    flex-shrink: 0;
    opacity: 0.45;
    display: flex;
    align-items: center;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Euclid Circular A', Arial, sans-serif;
    font-size: 1rem;
    font-weight: 300;
    color: var(--text-color);
    min-width: 0;
}

.search-input::placeholder {
    opacity: 0.4;
}

.search-esc-hint {
    flex-shrink: 0;
    font-family: 'Euclid Circular A', Arial, sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--text-color);
    opacity: 0.35;
    background: rgba(128, 128, 128, 0.15);
    border: none;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.search-esc-hint:hover {
    opacity: 0.7;
}

.search-status {
    flex-shrink: 0;
    padding: 0.45rem 1.1rem;
    font-size: 0.72rem;
    font-weight: 300;
    opacity: 0.5;
    min-height: 1.8rem;
    display: flex;
    align-items: center;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 0 0 0.5rem;
}

.search-year-group {
    padding: 0;
}

.search-year-label {
    padding: 0.5rem 1.1rem 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.4;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.search-current-badge {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #ffed00;
    background: rgba(255, 237, 0, 0.12);
    border-radius: 3px;
    padding: 1px 5px;
    opacity: 1;
}

.search-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.1rem;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.82rem;
    font-weight: 300;
    transition: background 0.1s ease;
    cursor: pointer;
    border-left: 2px solid transparent;
}

.search-result:hover,
.search-result:focus {
    background: rgba(255, 237, 0, 0.07);
    border-left-color: #ffed00;
    outline: none;
}

.search-result-profile {
    flex-shrink: 0;
    width: 108px;
    height: 30px;
    object-fit: contain;
    object-position: bottom;
    border-radius: 3px;
    opacity: 0.7;
    transition: opacity 0.1s ease;
}

.search-result:hover .search-result-profile,
.search-result:focus .search-result-profile {
    opacity: 1;
}

.search-result-profile-empty {
    display: block;
    width: 108px;
    height: 30px;
}

.search-result-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    min-width: 0;
}

.search-result-stage {
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.82rem;
    min-width: 4.5rem;
}
.search-result-route {
    font-weight: 400;
    font-size: 0.75rem;
    opacity: 0.55;
    margin-left: 0.4em;
}

.search-result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.search-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 1.1rem 0.3rem calc(1.1rem + 2px);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.35;
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
    margin-bottom: 0.25rem;
}

.search-results-header-profile {
    display: inline-block;
    width: 108px;
    flex-shrink: 0;
}

.search-result-winner {
    font-size: 0.75rem;
    opacity: 0.55;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    max-width: 200px;
    margin-left: auto;
}

.search-tag {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 3px;
    padding: 2px 5px;
    white-space: nowrap;
}

/* Tour winner synthetic year cards */
.search-year-winner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.1rem;
    margin: 0 0 2px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.8rem;
    border-left: 2px solid transparent;
    transition: background 0.1s ease;
}

.search-year-winner:hover,
.search-year-winner:focus {
    outline: none;
    background: rgba(255, 237, 0, 0.05);
}

.search-year-winner-yellow { border-left-color: #ffed00; }
.search-year-winner-green  { border-left-color: #3cb450; }
.search-year-winner-polka  { border-left-color: #dc3c3c; }

.search-year-winner-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    min-width: 7rem;
}

.search-year-winner-yellow .search-year-winner-label { color: #d4b800; }
.search-year-winner-green  .search-year-winner-label { color: #2e9944; }
.search-year-winner-polka  .search-year-winner-label { color: #c03030; }

html.dark-mode .search-year-winner-yellow .search-year-winner-label { color: #ffed00; }
html.dark-mode .search-year-winner-green  .search-year-winner-label { color: #5ddb74; }
html.dark-mode .search-year-winner-polka  .search-year-winner-label { color: #f07070; }

.search-year-winner-name {
    font-weight: 600;
    white-space: nowrap;
}

.search-year-winner-team {
    font-size: 0.72rem;
    opacity: 0.45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Search suggestion ("Did you mean?" / "Showing results for") */
.search-suggestion {
    padding: 6px 16px 2px;
    font-size: 13px;
    color: #888;
}
.search-suggestion.hidden { display: none; }
.search-suggestion--correction {
    color: #555;
    font-style: italic;
}
.search-suggestion-link {
    color: inherit;
    font-weight: 600;
    font-style: normal;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.search-suggestion-link:hover { color: #222; }
html.dark-mode .search-suggestion          { color: #999; }
html.dark-mode .search-suggestion--correction { color: #bbb; }
html.dark-mode .search-suggestion-link:hover  { color: #fff; }

.tag-tour-winner { background: rgba(255, 237, 0, 0.2); color: #d4b800; }
html.dark-mode .tag-tour-winner { color: #ffed00; }

.tag-winner    { background: rgba(255, 237,   0, 0.18); color: #d4b800; }
.tag-podium    { background: rgba(255, 237,   0, 0.08); color: #b09a00; }
.tag-attack    { background: rgba(240, 140,  20, 0.15); color: #b86800; }
.tag-event     { background: rgba(140, 120, 200, 0.15); color: #6b50b8; }
.tag-sprint    { background: rgba( 60, 180,  80, 0.15); color: #2e9944; }
.tag-milestone { background: rgba(220,  60,  60, 0.15); color: #c03030; }
.tag-yellow    { background: rgba(255, 237,   0, 0.12); color: #c4a800; }
.tag-green     { background: rgba( 60, 180,  80, 0.15); color: #2e9944; }
.tag-polka     { background: rgba(220,  60,  60, 0.15); color: #c03030; }
.tag-prose     { background: rgba(128, 128, 128, 0.12); color: inherit; opacity: 0.7; }
.tag-article   { background: rgba(128, 128, 128, 0.10); color: inherit; opacity: 0.6; }
.tag-location  { background: rgba( 80, 200, 220, 0.15); color: #1a8fa0; }
.tag-finish    { background: rgba(180,  30,  30, 0.85); color: #ffffff; }
.tag-climb     { background: rgba(220,  60,  60, 0.15); color: #c03030; }
.tag-withdrawal { background: rgba(128, 128, 128, 0.15); color: #666; }
.tag-default   { background: rgba(128, 128, 128, 0.12); color: inherit; }

html.dark-mode .tag-winner    { color: #ffed00; }
html.dark-mode .tag-podium    { color: #e0c800; }
html.dark-mode .tag-attack    { color: #f0a030; }
html.dark-mode .tag-event     { color: #a990e8; }
html.dark-mode .tag-milestone { color: #f07070; }
html.dark-mode .tag-yellow    { color: #ffed00; }
html.dark-mode .tag-green     { color: #5ddb74; }
html.dark-mode .tag-sprint    { color: #5ddb74; }
html.dark-mode .tag-polka     { color: #f07070; }
html.dark-mode .tag-location  { color: #50d0e0; }
html.dark-mode .tag-finish    { background: rgba(220, 60, 60, 0.45); color: #ffffff; }
html.dark-mode .tag-climb       { color: #f07070; }
html.dark-mode .tag-withdrawal { color: #999; }

/* Fixed floating search button */
.search-fab {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    max-width: 56px;
    height: 56px;
    padding: 0 20px;
    border-radius: 28px;
    border: none;
    background: var(--toggle-btn-background-color);
    color: var(--text-color);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: max-width 0.25s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0.72;
}

.search-fab:hover {
    max-width: 180px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
    opacity: 1;
}

.search-fab svg {
    flex-shrink: 0;
}

.search-fab-label,
.search-fab-hint {
    font-family: 'Euclid Circular A', Arial, sans-serif;
    font-weight: 600;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transition: opacity 0.15s ease 0.05s, max-width 0.2s ease;
}

.search-fab-label {
    font-size: 0.78rem;
}

.search-fab-hint {
    font-size: 0.62rem;
    opacity: 0;
}

.search-fab:hover .search-fab-label {
    opacity: 1;
    max-width: 60px;
}

.search-fab:hover .search-fab-hint {
    opacity: 0.45;
    max-width: 40px;
}

@media (max-width: 768px) {
    .search-fab {
        max-width: 160px;
        opacity: 0.88;
    }

    .search-fab-label {
        opacity: 1;
        max-width: 60px;
    }

    .search-fab-hint {
        display: none;
    }
}

@media (max-width: 600px) {
    .search-overlay {
        padding: 5vh 0.5rem 0.5rem;
    }
    .search-overlay-content {
        max-height: 88vh;
    }
}

/* ============================================================================
   MILESTONE EDITOR
   ============================================================================ */

.me-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4vh 1rem 1rem;
    box-sizing: border-box;
}
.me-overlay.hidden {
    display: none;
}
.me-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}
.me-panel {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--background-color);
    color: var(--text-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
    font-family: 'Euclid Circular A', Arial, sans-serif;
    font-size: 0.875rem;
}
.me-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    gap: 0.5rem;
}
.me-header-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
}
.me-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.01em;
}
.me-link-file {
    background: none;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Euclid Circular A', Arial, sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.6;
    padding: 0.25rem 0.55rem;
    transition: opacity 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.me-link-file:hover {
    opacity: 1;
    border-color: rgba(128, 128, 128, 0.6);
}
.me-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-color);
    opacity: 0.4;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: opacity 0.15s;
    border-radius: 4px;
}
.me-close:hover {
    opacity: 1;
}
.me-file-hint {
    font-size: 0.72rem;
    opacity: 0.4;
    margin: 0 0 0.75rem;
    font-style: italic;
    transition: opacity 0.2s;
}
.me-mode-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    background: var(--toggle-btn-background-color);
    border-radius: 5px;
    padding: 3px;
}
.me-mode-btn {
    flex: 1;
    background: none;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Euclid Circular A', Arial, sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.45;
    padding: 0.35rem 0.5rem;
    transition: background 0.15s, opacity 0.15s;
}
.me-mode-btn.active {
    background: var(--background-color);
    opacity: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.me-mode-btn:not(.active):hover {
    opacity: 0.75;
}
.me-row {
    display: flex;
    gap: 0.625rem;
    margin-bottom: 0.625rem;
    align-items: flex-end;
}
.me-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}
.me-field label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.5;
    white-space: nowrap;
}
.me-field input,
.me-field select,
.me-field textarea {
    background: var(--toggle-btn-background-color);
    color: var(--text-color);
    border: 1px solid rgba(128, 128, 128, 0.18);
    border-radius: 4px;
    padding: 0.45rem 0.6rem;
    font-family: 'Euclid Circular A', Arial, sans-serif;
    font-size: 0.82rem;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
.me-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    padding-right: 1.75rem;
}
.me-field input:focus,
.me-field select:focus,
.me-field textarea:focus {
    outline: none;
    border-color: rgba(255, 237, 0, 0.6);
}
.me-field textarea {
    resize: vertical;
    min-height: 68px;
    line-height: 1.5;
}
.me-divider {
    border: none;
    border-top: 1px solid rgba(128, 128, 128, 0.12);
    margin: 0.25rem 0 0.75rem;
}
.me-actions {
    margin-top: 1.125rem;
}
.me-save {
    width: 100%;
    padding: 0.65rem 1rem;
    background: #ffed00;
    color: #1A1B25;
    border: none;
    border-radius: 4px;
    font-family: 'Euclid Circular A', Arial, sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: opacity 0.15s;
}
.me-save:hover {
    opacity: 0.85;
}
.me-save:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.me-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: #1A1B25;
    color: #fff;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    font-family: 'Euclid Circular A', Arial, sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
}
html.dark-mode .me-toast {
    background: #e8e9ea;
    color: #1A1B25;
}
.me-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 600px) {
    .me-overlay {
        padding: 2vh 0.5rem 0.5rem;
        align-items: flex-start;
    }
    .me-panel {
        max-height: 95vh;
        padding: 1.25rem;
    }
}

/* Withdrawals list in tooltips */
.withdrawals-list {
    margin: 8px 0 4px 0;
}
.withdrawals-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.45;
}
.withdrawals-list ul {
    list-style: none;
    margin: 3px 0 0;
    padding: 0;
    padding-inline-start: 0;
}
.withdrawals-list li {
    display: flex;
    align-items: baseline;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    line-height: 1.55;
    padding: 1px 0;
}
.withdrawal-rider {
    font-weight: 400;
}
.withdrawal-team {
    opacity: 0.5;
    font-size: 0.9em;
    margin-left: 0.35em;
}
.withdrawal-reason {
    margin-left: auto;
    font-family: 'Inter', Verdana, sans-serif;
    font-size: 10px;
    font-style: normal;
    font-weight: 500;
    white-space: nowrap;
    background-color: rgba(220, 38, 38, 0.12);
    color: #dc2626;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    line-height: 1.4;
}

/* Editor: withdrawal rows */
.me-withdrawals-section {
    margin-bottom: 0.625rem;
}
.me-withdrawals-section > label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.5;
    margin-bottom: 0.375rem;
}
.me-withdrawal-row {
    align-items: center;
}
.me-withdrawal-row .me-field input {
    font-size: 0.82rem;
    padding: 0.35rem 0.5rem;
}
.me-btn-sm {
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border: 1px solid rgba(128, 128, 128, 0.25);
    border-radius: 3px;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.me-btn-sm:hover {
    opacity: 1;
}
.me-w-remove {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    line-height: 22px;
    text-align: center;
    padding: 0;
    margin-bottom: 2px;
}

/* ============================================================================
   AUTH HEADER
   ============================================================================ */

#auth-header {
    display: flex;
    align-items: center;
}

.auth-sign-in-btn {
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    height: 40px;
    padding: 0 18px;
    background: transparent;
    color: var(--text-color);
    border: 1.5px solid color-mix(in srgb, var(--text-color) 22%, transparent);
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.auth-sign-in-btn:hover,
.auth-sign-in-btn:focus-visible {
    border-color: #ffed00;
    background: color-mix(in srgb, #ffed00 14%, transparent);
    outline: none;
}

/* User icon + dropdown */
.auth-user-menu {
    position: relative;
}

.auth-user-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 43px;
    height: 43px;
    border-radius: 50%;
    border: none;
    background: color-mix(in srgb, var(--text-color) 8%, transparent);
    padding: 0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* Ring drawn on top of the avatar image so the border sits above the photo */
.auth-user-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--text-color) 22%, transparent);
    pointer-events: none;
    transition: box-shadow 0.2s ease;
}

.auth-avatar-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
}

.auth-user-btn:hover,
.auth-user-btn:focus-visible,
.auth-user-btn[aria-expanded="true"] {
    background: color-mix(in srgb, #ffed00 18%, transparent);
    outline: none;
}

.auth-user-btn:hover::after,
.auth-user-btn:focus-visible::after,
.auth-user-btn[aria-expanded="true"]::after {
    box-shadow: inset 0 0 0 1.5px #ffed00;
}

.auth-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--background-color);
    border: 1px solid color-mix(in srgb, var(--text-color) 14%, transparent);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    z-index: 100;
}

.auth-dropdown-email {
    padding: 10px 16px 8px;
    font-size: 12px;
    color: color-mix(in srgb, var(--text-color) 45%, transparent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 1px solid color-mix(in srgb, var(--text-color) 8%, transparent);
}

.auth-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    text-align: left;
    color: var(--text-color);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.1s;
}

.auth-dropdown-item:hover {
    background: color-mix(in srgb, var(--text-color) 6%, transparent);
}

.auth-dropdown-signout {
    color: color-mix(in srgb, var(--text-color) 65%, transparent);
    border-top: 1px solid color-mix(in srgb, var(--text-color) 8%, transparent);
}

.auth-dropdown-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
}
