body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

.container {
    display: flex;
    height: calc(100vh - 120px); /* Account for timeline height */
    width: 100vw;
    position: relative;
}

#map {
    flex: 2;
    height: 100%;
    position: relative;
}

.info-panel {
    flex: 1;
    padding: 20px;
    background-color: #f5f5f5;
    overflow-y: auto;
    min-width: 300px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.info-panel h2 {
    margin: 0;
    color: #333;
    border-bottom: none;
    padding-bottom: 0;
    flex-shrink: 0;
}

#raceStatus {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
}

.race-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.8em;
}

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

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

.race-status.finished {
    background: #f8d7da;
    color: #721c24;
}

.elapsed-time {
    font-family: monospace;
    font-weight: bold;
    color: #333;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.finish-time {
    font-family: monospace;
    font-weight: bold;
    color: #155724;
    background: #d4edda;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
    font-size: 1em;
}

.leaderboard-section {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

#leaderboardTable {
    overflow-y: auto;
    height: calc(100vh - 200px); /* Account for timeline and header */
    padding-right: 10px;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.leaderboard-row:last-child {
    border-bottom: none;
}

.leaderboard-row:hover {
    background-color: #f8f9fa;
    cursor: pointer;
}

.leaderboard-row.selected {
    background-color: #e3f2fd;
    border-left: 4px solid #0077FF;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
    transform: translateX(2px);
}

.position {
    font-weight: bold;
    color: #0077FF;
    min-width: 30px;
    text-align: center;
}

.bib-number {
    background: #0077FF;
    color: white;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: bold;
    width: 32px;
    height: 32px;
    text-align: center;
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.athlete-info {
    flex: 1;
    margin-left: 8px;
}

.athlete-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 2px;
}

.athlete-team {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 2px;
}

.athlete-stats {
    font-size: 0.8em;
    color: #888;
}

.distance {
    font-weight: bold;
    color: #00C851;
}

.status {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: bold;
    text-transform: uppercase;
}

.status.ready {
    background: #e3f2fd;
    color: #1976d2;
}

.status.racing {
    background: #e8f5e8;
    color: #2e7d32;
}

.status.finished {
    background: #fff3e0;
    color: #f57c00;
}

/* Course styling - Note: These are Google Maps polyline properties, not CSS */

/* Timeline and Playback Controls Responsive Layout */
#timeline {
    height: auto;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    box-sizing: border-box;
    border-top: 1px solid #e0e0e0;
    z-index: 100;
}

.timeline-top {
    width: 100%;
    margin-bottom: 0;
}

.slider-container {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 15px;
}

#timelineSlider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

#timelineSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0077FF;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#timelineSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0077FF;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#timeDisplay {
    font-family: monospace;
    font-weight: bold;
    color: #333;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    min-width: 100px;
    text-align: center;
    font-size: 14px;
    margin: 0 10px;
}

.timeline-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
    margin-top: 10px;
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

#playBtn,
#pauseBtn,
#stopBtn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: #0077FF;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#playBtn:hover,
#pauseBtn:hover,
#stopBtn:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#playBtn:disabled,
#pauseBtn:disabled,
#stopBtn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

#speedSelect {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

#speedSelect:hover {
    border-color: #0077FF;
}

#speedSelect:focus {
    border-color: #0077FF;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Sponsor Banner Styles */
.sponsor-banner {
    position: absolute;
    z-index: 1200;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    padding: 6px 10px;
    max-width: 400px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    transition: opacity 0.3s;
    pointer-events: auto;
}
.sponsor-banner--dynamic {
    left: 10px;
    bottom: 0;
}
.sponsor-banner img {
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}
.sponsor-banner a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Mobile: scale down and ensure inside map */
@media (max-width: 600px) {
    .sponsor-banner {
        height: 48px;
        max-width: 120px;
        padding: 3px 6px;
    }
    .sponsor-banner--dynamic {
        left: 8px;
    }
}

@media (min-width: 768px) {
    .container {
        flex-direction: row;
        height: calc(100vh - 70px);
    }
    #map {
        flex: 2;
        min-width: 0;
        height: 100%;
    }
    .info-panel {
        flex: 1;
        min-width: 300px;
        max-width: 400px;
        padding: 20px;
        height: 100%;
    }
}

@media (max-width: 767px) {
    .container {
        flex-direction: column;
        height: auto;
    }
    #map {
        width: 100vw;
        min-height: 220px;
        height: 40vh;
        flex: none;
    }
    .info-panel {
        width: 100vw;
        min-width: 0;
        max-width: none;
        padding: 12px 6px;
        height: auto;
    }
    #leaderboardTable {
        height: auto;
        max-height: 300px;
    }
    }
    
@media (min-width: 600px) {
    #timeline {
        flex-direction: row;
        align-items: center;
        height: 70px;
        padding: 0 20px;
    }
    .timeline-top {
        flex: 1;
        margin-bottom: 0;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 15px;
    }
    .slider-container {
        flex: 1;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 15px;
    }
    .control-buttons {
        order: -1;
        margin-right: 15px;
    }
    .timeline-controls {
        flex: none;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        margin-top: 0;
        gap: 15px;
        width: auto;
    }
    .speed-control {
        margin-left: 10px;
    }
    #timeDisplay {
        margin: 0 10px;
    }
}

/* Phone horizontal: smaller sponsor banner */
@media (max-width: 900px) and (min-width: 600px) and (orientation: landscape) {
    .sponsor-banner {
        height: 40px !important;
        max-width: 90px !important;
        padding: 2px 4px !important;
    }
    .sponsor-banner img {
        max-height: 36px !important;
    }
}

@media (max-width: 599px) {
    #timeline {
        flex-direction: column;
        height: auto;
        padding: 10px 5px;
    }
    .timeline-top {
        margin-bottom: 8px;
    }
    .slider-container {
        width: 100%;
        gap: 10px;
    }
    .timeline-controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 8px;
        margin-top: 0;
    }
    .control-buttons {
        gap: 6px;
    }
    .speed-control {
        margin-left: 0;
    }
    #timeDisplay {
        margin: 0 6px;
        font-size: 12px;
        min-width: 80px;
        padding: 6px 8px;
    }
}

/* Weather Card Styles */
.weather-card {
    position: absolute;
    top: 20px;
    z-index: 1300;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 12px 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 24px;
    font-family: 'Poppins', sans-serif;
    color: #4a5568;
}

.weather-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    white-space: nowrap;
}

.weather-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #63b3ed;
}

.weather-icon-img {
    width: 20px;
    height: 20px;
    filter: invert(66%) sepia(26%) saturate(1267%) hue-rotate(177deg) brightness(100%) contrast(86%);
    /* This filter converts the PNG to light blue (#63b3ed) */
}

.weather-value {
    font-weight: 600;
    color: #2d3748;
    font-size: 18px;
    font-family: 'Poppins', sans-serif;
}

.weather-unit {
    color: #718096;
    font-size: 14px;
    font-weight: 400;
    font-family: 'Poppins', sans-serif;
}

.wind-direction-container {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wind-circle {
    width: 32px;
    /*height: 32px;*/
    aspect-ratio: 1;
    border: 2px solid #63b3ed;
    border-radius: 50%;
    position: relative;
    background: rgba(99, 179, 237, 0.01);
}

.wind-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center;
    color: #63b3ed;
    aspect-ratio: 1;
}

/* Mobile responsive for weather card */
@media (max-width: 600px) {
    .weather-card {
        top: 10px;
        padding: 8px 12px;
        gap: 16px;
    }
    
    .weather-item {
        font-size: 14px;
        gap: 6px;
    }
    
    .weather-value {
        font-size: 16px;
    }
    
    .weather-icon {
        width: 20px;
        height: 20px;
        font-size: 16px;
    }
    
    .wind-direction-container {
        width: 28px;
        height: 28px;
    }
    
    .wind-circle {
        width: 28px;
        height: 28px;
    }
    
    .wind-arrow {
        /* Wind arrow styling handled by SVG - no additional CSS needed */
        display: block;
    }
}

/* Event Info Card Responsive Styles */
#eventInfoCard {
    transition: all 0.3s ease;
}

/* Horizontal/landscape orientation detection */
@media (max-width: 1024px) and (max-height: 600px) and (orientation: landscape) {
    #eventInfoCard {
        top: 8px !important;
        left: 8px !important;
        right: 8px !important;
        padding: 8px 12px !important;
    }
    
    #eventInfoCard > div:first-child {
        font-size: 0.7em !important;
        margin-bottom: 2px !important;
    }
    
    #eventInfoCard > div:nth-child(2) {
        font-size: 0.6em !important;
        margin-bottom: 2px !important;
    }
}

/* Smaller horizontal screens */
@media (max-width: 800px) and (max-height: 500px) and (orientation: landscape) {
    #eventInfoCard {
        top: 6px !important;
        left: 6px !important;
        right: 6px !important;
        padding: 6px 10px !important;
    }
    
    #eventInfoCard > div:first-child {
        font-size: 0.65em !important;
        margin-bottom: 1px !important;
    }
    
    #eventInfoCard > div:nth-child(2) {
        font-size: 0.55em !important;
        margin-bottom: 1px !important;
    }
}

@media (max-width: 767px) {
    #eventInfoCard {
        top: 10px !important;
        left: 10px !important;
        right: 10px !important;
        min-width: auto !important;
        max-width: none !important;
        padding: 12px 16px !important;
    }
    
    #eventInfoCard > div:first-child {
        font-size: 0.8em !important;
        margin-bottom: 4px !important;
    }
    
    #eventInfoCard > div:nth-child(2) {
        font-size: 0.7em !important;
        margin-bottom: 4px !important;
    }
}

@media (max-width: 480px) {
    #eventInfoCard {
        top: 8px !important;
        left: 8px !important;
        right: 8px !important;
        padding: 10px 14px !important;
    }
    
    #eventInfoCard > div:first-child {
        font-size: 0.8em !important;
    }
    
    #eventInfoCard > div:nth-child(2) {
        font-size: 0.7em !important;
    }
}

@media (max-width: 360px) {
    #eventInfoCard {
        top: 6px !important;
        left: 6px !important;
        right: 6px !important;
        padding: 8px 12px !important;
    }
    
    #eventInfoCard > div:first-child {
        font-size: 0.8em !important;
        margin-bottom: 3px !important;
    }
    
    #eventInfoCard > div:nth-child(2) {
        font-size: 0.7em !important;
        margin-bottom: 3px !important;
    }
}

