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

.container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

#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;
}

/* WebSocket Connection Status Styles */
.status-connected {
    color: #28a745;
    font-weight: bold;
    animation: pulse 2s infinite;
}

.status-connecting {
    color: #ffc107;
    font-weight: bold;
}

.status-disconnected {
    color: #dc3545;
    font-weight: bold;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}



.finish-time {
    font-family: monospace;
    font-weight: bold;
    color: #155724;
    background: #d4edda;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    white-space: nowrap;
    display: inline-block;
}

.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 - 120px);
    padding-right: 10px;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
    min-height: 60px;
}

.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);
}

.cheer-button {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: 12px;
    opacity: 0.5;
    flex-shrink: 0;
}

.cheer-button:disabled {
    cursor: not-allowed;
    opacity: 0.3;
}

.cheer-button:not(:disabled):hover {
    background-color: #fff3cd;
    transform: scale(1.1);
    opacity: 1;
}

.cheer-button:not(:disabled):active {
    transform: scale(0.95);
}

.cheer-leaderboard {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.cheer-leaderboard h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 14px;
    text-align: center;
}

.cheer-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 12px;
    color: #333;
    font-weight: bold;
}

.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-name.sos {
    color: #FF0000;
    font-weight: bold;
}

.athlete-name.sos::before {
    content: "SOS - ";
    color: #FF0000;
    font-weight: bold;
}

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

.athlete-stats {
    font-size: 0.8em;
    color: #888;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.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;
}

.status.dnf {
    background: #ffebee;
    color: #d32f2f;
}

.status.not_boarded {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* Weather Card Styles */
.weather-card {
    position: absolute;
    top: 20px;
    left: 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;
        right: 10px;
        left: auto;
        padding: 10px 16px;
        gap: 12px;
        flex-direction: column;
        flex-wrap: nowrap;
        max-height: none;
        width: auto;
        min-width: 120px;
        max-width: 140px;
        align-items: center;
    }
    
    .weather-item {
        font-size: 13px;
        gap: 6px;
        min-width: auto;
        flex: 0 0 auto;
        justify-content: center;
        width: 100%;
    }
    
    .weather-value {
        font-size: 15px;
    }
    
    .weather-unit {
        font-size: 12px;
    }
    
    .weather-icon {
        width: 18px;
        height: 18px;
        font-size: 16px;
    }
    
    .weather-icon-img {
        width: 18px;
        height: 18px;
    }
    
    .wind-direction-container {
        width: 18px;
        height: 18px;
    }
    
    .wind-circle {
        width: 18px;
        height: 18px;
    }
}

/* Extra small mobile devices - horizontal layout for better space usage */
@media (max-width: 480px) {
    .weather-card {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        padding: 8px 12px;
        min-width: 160px;
        max-width: 200px;
    }
    
    .weather-item {
        flex: 0 0 45%;
        min-width: 70px;
        font-size: 12px;
        gap: 4px;
    }
    
    .weather-value {
        font-size: 14px;
    }
    
    .weather-unit {
        font-size: 11px;
    }
    
    .weather-icon {
        width: 16px;
        height: 16px;
    }
    
    .weather-icon-img {
        width: 16px;
        height: 16px;
    }
    .wind-direction-container {
        width: 18px;
        height: 18px;
    }
    
    .wind-circle {
        width: 18px;
        height: 18px;
    }
}

/* Course styling */
.course-polyline {
    stroke-color: #0077FF;
    stroke-opacity: 0.3;
    stroke-weight: 6;
    fill-opacity: 0.1;
}

/* 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, top 0.4s cubic-bezier(0.4,0,0.2,1), left 0.4s cubic-bezier(0.4,0,0.2,1);
    pointer-events: auto;
}
.sponsor-banner--dynamic {
    left: 10px;
    top: 10px;
}
.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: 56px;
        max-width: 140px;
        padding: 4px 8px;
        top: 10px;
        left: 10px;
        border-radius: 8px;
    }
    
    .sponsor-banner img {
        max-height: 48px;
        width: auto;
    }
}

/* 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;
    }
}

/* Mobile landscape: optimize weather card */
@media (max-width: 767px) and (orientation: landscape) {
    .weather-card {
        top: 8px;
        right: 310px; /* Account for leaderboard space (300px max-width + 10px margin) */
        padding: 6px 10px;
        gap: 6px;
        max-height: 100px;
        min-width: 120px;
    }
    
    .weather-item {
        font-size: 11px;
        gap: 3px;
        min-width: 50px;
    }
    
    .weather-value {
        font-size: 12px;
    }
    
    .weather-unit {
        font-size: 10px;
    }
    
    .weather-icon {
        width: 14px;
        height: 14px;
        font-size: 12px;
    }
    
    .weather-icon-img {
        width: 14px;
        height: 14px;
    }
    
    .wind-direction-container {
        width: 20px;
        height: 20px;
    }
}

/* Responsive Layout - Desktop/Tablet */
@media (min-width: 768px) {
    .container {
        flex-direction: row;
    }
    #map {
        flex: 2;
        min-width: 0;
        height: 100%;
    }
    .info-panel {
        flex: 1;
        min-width: 300px;
        max-width: 400px;
        padding: 20px;
    }
}

/* Sponsor banner positioning for desktop */
@media (min-width: 768px) {
    .sponsor-banner--dynamic {
        left: 10px;
        top: 10px;
    }
}

/* Responsive Layout - Mobile */
@media (max-width: 767px) {
    .container {
        flex-direction: column;
        height: auto;
    }
    #map {
        width: 100vw;
        min-height: 220px;
        height: 60vh;
        flex: none;
    }
    .info-panel {
        width: 100vw;
        min-width: 0;
        max-width: none;
        padding: 12px 6px;
        height: auto;
    }
    #leaderboardTable {
        height: auto;
        max-height: 300px;
    }
}

/* Phone Horizontal - Side by side layout */
@media (max-width: 767px) and (orientation: landscape) {
    .container {
        flex-direction: row;
        height: calc(100vh - 20px);
    }
    #map {
        flex: 2;
        width: auto;
        height: 100%;
        min-height: auto;
    }
    .info-panel {
        flex: 1;
        width: auto;
        min-width: 200px;
        max-width: 300px;
        padding: 8px;
        height: 100%;
    }
    #leaderboardTable {
        height: calc(100vh - 60px);
        max-height: none;
    }
    
    /* Smaller text for mobile horizontal view */
    .info-panel h2 {
        font-size: 16px;
    }
    
    #raceStatus {
        font-size: 0.75em;
    }
    
    .race-status {
        font-size: 0.7em;
        padding: 3px 6px;
    }
    
    .elapsed-time {
        font-size: 0.8em;
        padding: 3px 6px;
    }
    
    .leaderboard-row {
        font-size: 0.75em;
        padding: 6px 0;
    }
    
    .athlete-name {
        font-size: 0.9em;
    }
    
    .athlete-team {
        font-size: 0.7em;
    }
    
    .athlete-stats {
        font-size: 0.7em;
    }
    
    .bib-number {
        font-size: 0.7em;
        width: 28px;
        height: 28px;
        padding: 6px;
    }
    
    .position {
        font-size: 0.8em;
        min-width: 25px;
    }
    
    .status {
        font-size: 0.6em;
        padding: 1px 4px;
    }
}

/* Make sure .container is position:relative for absolute children */
.container {
    position: relative;
} 