/* ==========================================================================
   REMO DO HUD - MARIO KART 8 ARCADE ROWING
   ========================================================================== */

:root {
    --color-primary: #0070EB;      /* Azul clássico Mario */
    --color-accent: #00C853;       /* Verde Luigi */
    --color-warning: #FFD600;      /* Amarelo Super Estrela */
    --color-danger: #E52521;       /* Vermelho Mario */
    --color-bg-mk-card: rgba(255, 255, 255, 0.92); /* Branco leitoso translúcido oficial Mario Kart 8 */
    --color-card-border: #FFE600;  /* Chanfro amarelo ouro */
    --color-card-border-bottom: #E5A800; /* Borda 3D chanfrada dourada */
    --color-text-dark: #1E293B;    /* Texto escuro de alto contraste */
    --color-text-muted: #64748B;
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-hud: 'Rajdhani', 'Inter', sans-serif;
    --font-arcade: 'Titan One', 'Fredoka', cursive, sans-serif;
    --font-mk: 'Fredoka', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body, html {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #030712;
    font-family: var(--font-main);
    color: #1E293B;
}

/* Container do canvas 3D */
#webgl-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Camada da Interface (HUD) sobreposta ao 3D */
#hud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px 24px;
}

button, input, select, .interactive {
    pointer-events: auto;
}

/* ==========================================================================
   COCKPIT SUPERIOR UNIFICADO MARIO KART 8
   ========================================================================== */
.top-cockpit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
    position: relative;
}

.cockpit-block {
    display: flex;
    align-items: center;
    background: var(--color-bg-mk-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 2px solid var(--color-card-border);
    border-bottom: 4px solid var(--color-card-border-bottom);
    border-radius: 20px;
    padding: 8px 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22), 0 0 10px rgba(255, 230, 0, 0.2);
    color: var(--color-text-dark);
}

/* Bloco 1: Conexão Bluetooth e Status do Remo */
.brand-block {
    gap: 10px;
    padding: 6px 14px;
    flex-shrink: 0;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #FFFFFF;
    border: 2px solid #E2E8F0;
    padding: 6px 14px;
    border-radius: 30px;
    font-family: var(--font-mk);
    font-size: 0.8rem;
    font-weight: 800;
    color: #334155;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: #94A3B8;
    transition: all 0.3s ease;
}

.status-dot.searching {
    background-color: #F59E0B;
    box-shadow: 0 0 10px #F59E0B;
    animation: pulse 1.2s infinite ease-in-out;
}

.status-dot.connected {
    background-color: #10B981;
    box-shadow: 0 0 12px #10B981;
}

.cockpit-connect-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #00C6FF, #0072FF);
    border: 2px solid #FFE600;
    color: #FFFFFF;
    padding: 6px 14px;
    border-radius: 30px;
    font-family: var(--font-mk);
    font-size: 0.82rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 114, 255, 0.35);
    transition: all 0.2s ease;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    white-space: nowrap;
}

.cockpit-connect-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(0, 114, 255, 0.5);
    background: linear-gradient(135deg, #00D4FF, #0080FF);
}

.cockpit-connect-btn.connected {
    background: #F1F5F9;
    border-color: #CBD5E1;
    color: #475569;
    box-shadow: none;
    text-shadow: none;
}

.btn-ble-icon {
    font-size: 0.95rem;
}

/* Bloco 2: Telemetria Central Alinhada e Ampla */
.metrics-block {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    flex: 1;
    max-width: 680px;
    padding: 6px 20px;
    gap: 14px;
}

.cockpit-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 95px;
}

.m-label {
    font-family: var(--font-mk);
    font-size: 0.72rem;
    font-weight: 900;
    color: #64748B;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3px;
}

.m-val {
    font-family: var(--font-arcade);
    font-size: 1.65rem;
    font-weight: 900;
    color: #0F172A;
    line-height: 1;
    height: 28px;
    display: flex;
    align-items: baseline;
    justify-content: center;
    white-space: nowrap;
    text-shadow: 1px 1px 0px #FFFFFF;
}

.m-val small {
    font-family: var(--font-mk);
    font-size: 0.78rem;
    font-weight: 800;
    color: #64748B;
    line-height: 1;
    margin-left: 3px;
    text-transform: none;
    display: inline;
}

.m-divider {
    width: 2px;
    height: 30px;
    background: #E2E8F0;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Bloco 3: Ações e Dock */
.actions-block {
    gap: 12px;
    padding: 5px 8px;
}

.cockpit-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 16px;
    padding: 8px 20px;
    font-family: var(--font-arcade);
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-transform: uppercase;
}

.cockpit-action-btn.start-state {
    background: linear-gradient(180deg, #FF453A 0%, #E52521 52%, #B71C1C 100%);
    color: #FFFFFF;
    border: 2px solid #FFE600;
    border-bottom: 5px solid #800000;
    box-shadow: 0 4px 15px rgba(229, 37, 33, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.45);
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #800000;
}

.cockpit-action-btn.start-state:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(229, 37, 33, 0.7), inset 0 2px 0 rgba(255, 255, 255, 0.6);
}

.cockpit-action-btn.start-state:active {
    transform: translateY(3px);
    border-bottom-width: 2px;
    box-shadow: 0 2px 8px rgba(229, 37, 33, 0.5);
}

.cockpit-action-btn.stop-state {
    background: linear-gradient(180deg, #FF9500 0%, #E65100 50%, #BF360C 100%);
    color: #FFFFFF;
    border: 2px solid #FFFFFF;
    border-bottom: 5px solid #5D1A00;
    box-shadow: 0 4px 15px rgba(230, 81, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.45);
    text-shadow: 2px 2px 0 #000;
}

.cockpit-action-btn.stop-state:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(230, 81, 0, 0.7);
}

.cockpit-action-btn.stop-state:active {
    transform: translateY(3px);
    border-bottom-width: 2px;
}

.cockpit-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Dock de Ações Rápidas Estilo Mario Kart */
.cockpit-dock {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(12, 18, 30, 0.85);
    padding: 4px 8px;
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.dock-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.dock-btn:hover {
    transform: translateY(-3px) scale(1.08);
}

.dock-btn:active {
    transform: translateY(2px) scale(0.96);
}

/* Temas Individuais dos Botões Mario Kart */
.dock-btn.btn-mk-routes {
    background: linear-gradient(180deg, #43A047 0%, #2E7D32 100%);
    border: 1px solid #81C784;
    border-bottom: 3px solid #1B5E20;
    color: #FFFFFF;
}

.dock-btn.btn-mk-profile {
    background: linear-gradient(180deg, #E52521 0%, #C62828 100%);
    border: 1px solid #FF8A80;
    border-bottom: 3px solid #800000;
    color: #FFFFFF;
}

.dock-btn.btn-mk-camera {
    background: linear-gradient(180deg, #9C27B0 0%, #6A1B9A 100%);
    border: 1px solid #BA68C8;
    border-bottom: 3px solid #4A148C;
    color: #FFFFFF;
}

.dock-btn.btn-mk-audio {
    background: linear-gradient(180deg, #29B6F6 0%, #0288D1 100%);
    border: 1px solid #81D4FA;
    border-bottom: 3px solid #01579B;
    color: #FFFFFF;
}

.dock-btn.btn-mk-simulate {
    background: linear-gradient(180deg, #FFEE58 0%, #FBC02D 100%);
    border: 1px solid #FFF59D;
    border-bottom: 3px solid #E65100;
    color: #3E2723;
    animation: starPulse 2.2s infinite ease-in-out;
}

@keyframes starPulse {
    0%, 100% { box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35), 0 0 12px rgba(255, 235, 59, 0.4); }
    50% { box-shadow: 0 4px 14px rgba(255, 235, 59, 0.8), 0 0 20px rgba(255, 235, 59, 0.7); }
}

.dock-btn.btn-mk-history {
    background: linear-gradient(180deg, #FF7043 0%, #D84315 100%);
    border: 1px solid #FFAB91;
    border-bottom: 3px solid #BF360C;
    color: #FFFFFF;
}

.dock-btn.btn-mk-fullscreen {
    background: linear-gradient(180deg, #00BCD4 0%, #00838F 100%);
    border: 1px solid #80DEEA;
    border-bottom: 3px solid #004D40;
    color: #FFFFFF;
}

.dock-btn.btn-mk-fullscreen.is-fullscreen-active {
    background: linear-gradient(180deg, #FF9800 0%, #E65100 100%);
    border: 1px solid #FFCC80;
    border-bottom: 3px solid #BF360C;
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.6);
}

.dock-btn.btn-mk-switch {
    background: linear-gradient(180deg, #AB47BC 0%, #7B1FA2 100%);
    border: 1px solid #CE93D8;
    border-bottom: 3px solid #4A148C;
    color: #FFFFFF;
}

.dock-icon {
    font-size: 1.15rem;
    line-height: 1;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}

.dock-label {
    font-family: var(--font-mk);
    font-size: 0.62rem;
    font-weight: 800;
    color: #FFFFFF;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.btn-mk-simulate .dock-label {
    color: #3E2723;
    text-shadow: none;
}

/* Container das Pílulas Centrais do Cockpit (Rota & Atleta) */
.top-pills-row {
    position: absolute;
    top: 86px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
}

/* Pílula de Rota Ativa Mario Kart 8 */
.active-route-pill {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-bg-mk-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 2px solid #FFE600;
    border-bottom: 4px solid #E5A800;
    padding: 6px 18px;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 10px rgba(255, 230, 0, 0.3);
    font-family: var(--font-mk);
}

.active-route-pill:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28), 0 0 16px rgba(255, 230, 0, 0.5);
}

/* Pílula de Atleta Ativo (Seletor Rápido Rudi / Esposa) */
.active-athlete-pill {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-bg-mk-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 2px solid #38BDF8;
    border-bottom: 4px solid #0284C7;
    padding: 4px 12px 4px 6px;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 10px rgba(56, 189, 248, 0.3);
    font-family: var(--font-mk);
}

.active-athlete-pill:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28), 0 0 16px rgba(56, 189, 248, 0.5);
}

.athlete-pill-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #FFFFFF;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    background: #0F172A;
}

.athlete-pill-info {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.athlete-pill-name {
    font-family: var(--font-mk);
    font-size: 0.82rem;
    font-weight: 900;
    color: #0F172A;
}

.athlete-pill-meta {
    font-family: var(--font-arcade);
    font-size: 0.68rem;
    font-weight: 900;
    color: #0284C7;
}

.btn-quick-switch-athlete {
    background: rgba(2, 132, 199, 0.12);
    border: 1px solid rgba(2, 132, 199, 0.3);
    color: #0284C7;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-left: 2px;
}

.btn-quick-switch-athlete:hover {
    background: #0284C7;
    color: #FFFFFF;
    transform: rotate(180deg);
}

.pill-dot {
    font-size: 1.05rem;
}

.route-name {
    font-size: 0.86rem;
    font-weight: 900;
    color: #1E293B;
    letter-spacing: 0.3px;
}

.route-target-tag {
    font-family: var(--font-arcade);
    font-size: 0.76rem;
    font-weight: 900;
    color: #E65100;
    background: #FEF3C7;
    border: 1px solid #FCD34D;
    padding: 2px 8px;
    border-radius: 10px;
}

/* ==========================================================================
   DOMO / ARCO CENTRAL DE RITMO ALVO MARIO KART 8
   ========================================================================== */
.target-pace-dome {
    display: none !important;
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.target-block-tag {
    background: var(--color-bg-mk-card);
    backdrop-filter: blur(10px);
    border: 2px solid #FFE600;
    border-bottom: 3px solid #E5A800;
    padding: 4px 16px;
    border-radius: 14px;
    font-family: var(--font-mk);
    font-size: 0.78rem;
    font-weight: 900;
    color: #1E293B;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dome-graphic {
    width: 270px;
    height: 115px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top-left-radius: 135px;
    border-top-right-radius: 135px;
    background: radial-gradient(circle at 50% 100%, rgba(0, 200, 83, 0.35) 0%, rgba(0, 200, 83, 0.06) 70%, transparent 100%);
    border-top: 4px solid #00C853;
    box-shadow: 0 -8px 24px rgba(0, 200, 83, 0.3);
}

.dome-pace-text {
    font-family: var(--font-arcade);
    font-size: 2.3rem;
    font-weight: 900;
    color: #00C853;
    text-shadow: 2px 2px 0px #000, 0 0 12px rgba(0, 200, 83, 0.5);
    margin-top: 25px;
}

.dome-pace-text small {
    font-family: var(--font-mk);
    font-size: 1.05rem;
    font-weight: 800;
    color: #FFFFFF;
}

/* ==========================================================================
   PAINEL INFERIOR (BOTTOM HUD) - TEMA OFICIAL MARIO KART 8
   ========================================================================== */
.bottom-hud {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    position: relative;
    z-index: 20;
    padding-right: 0;
    gap: 16px;
}

/* Caixa de Split 500m (Inferior Esquerdo) */
.split-card-hud {
    background: var(--color-bg-mk-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 2px solid var(--color-card-border);
    border-bottom: 4px solid var(--color-card-border-bottom);
    border-radius: 22px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.split-circle-timer {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 4px solid #E2E8F0;
    border-top-color: #00C853;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-arcade);
    font-size: 1.05rem;
    font-weight: 800;
    color: #1E293B;
    background: #FFFFFF;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.split-stats {
    display: flex;
    flex-direction: column;
}

.split-label {
    font-family: var(--font-mk);
    font-size: 0.70rem;
    font-weight: 900;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.split-value {
    font-family: var(--font-arcade);
    font-size: 1.6rem;
    font-weight: 900;
    color: #0F172A;
    line-height: 1.1;
}

.split-value small {
    font-family: var(--font-mk);
    font-size: 0.85rem;
    font-weight: 800;
    color: #64748B;
}

/* Console Central de Telemetria Desimpedido e Ampliado */
.center-gauge-hud {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    background: var(--color-bg-mk-card);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 2px solid var(--color-card-border);
    border-bottom: 5px solid var(--color-card-border-bottom);
    border-radius: 28px;
    padding: 10px 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
    margin: 0 auto;
}

.side-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
}

.side-metric .metric-val {
    font-family: var(--font-arcade);
    font-size: 2.2rem;
    font-weight: 900;
    color: #0F172A;
    line-height: 1;
}

.side-metric.spm-box .metric-val {
    color: #0284C7;
    text-shadow: 1px 1px 0px #BAE6FD;
}

.side-metric.watts-box .metric-val {
    color: #EA580C;
    text-shadow: 1px 1px 0px #FFEDD5;
}

.side-metric.hr-box .metric-val {
    font-size: 1.8rem;
    color: #DC2626;
}

.side-metric .metric-unit {
    font-family: var(--font-mk);
    font-size: 0.70rem;
    font-weight: 900;
    color: #475569;
    letter-spacing: 0.6px;
    margin-top: 3px;
    text-transform: uppercase;
}

.spm-highlight {
    color: #0284C7 !important;
}

.gauge-arc-wrapper {
    position: relative;
    width: 170px;
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.gauge-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 170px;
    height: 100px;
}

.gauge-bg {
    fill: none;
    stroke: #E2E8F0;
    stroke-width: 10;
    stroke-linecap: round;
}

.gauge-fill {
    fill: none;
    stroke: url(#gaugeGradient);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 235;
    stroke-dashoffset: 120;
    transition: stroke-dashoffset 0.3s ease;
}

.gauge-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2px;
}

.gauge-pace {
    font-family: var(--font-arcade);
    font-size: 2.1rem;
    font-weight: 900;
    color: #0F172A;
    line-height: 1;
}

.gauge-pace-unit {
    font-family: var(--font-mk);
    font-size: 0.65rem;
    font-weight: 800;
    color: #64748B;
    margin-top: 2px;
}

/* ==========================================================================
   CARD DA CURVA DE FORÇA BIOMECÂNICA (INFERIOR DIREITO)
   ========================================================================== */
.force-curve-card-hud {
    background: var(--color-bg-mk-card);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 2px solid var(--color-card-border);
    border-bottom: 4px solid var(--color-card-border-bottom);
    border-radius: 22px;
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    min-width: 280px;
    max-width: 310px;
    pointer-events: auto;
}

.force-curve-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.force-curve-title-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.force-curve-icon {
    font-size: 1.05rem;
}

.force-curve-title {
    font-family: var(--font-mk);
    font-size: 0.72rem;
    font-weight: 900;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.coach-stroke-badge {
    font-family: var(--font-mk);
    font-size: 0.64rem;
    font-weight: 900;
    color: #0284C7;
    background: rgba(2, 132, 199, 0.12);
    border: 1px solid rgba(2, 132, 199, 0.35);
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    transition: all 0.25s ease;
}

.coach-stroke-badge.perfect {
    color: #059669;
    background: rgba(5, 150, 105, 0.15);
    border-color: rgba(5, 150, 105, 0.45);
}

.coach-stroke-badge.warning {
    color: #D97706;
    background: rgba(217, 119, 6, 0.15);
    border-color: rgba(217, 119, 6, 0.45);
}

.coach-stroke-badge.action {
    color: #DC2626;
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.45);
}

.force-curve-canvas-wrap {
    width: 100%;
    height: 92px;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.force-curve-canvas-wrap canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.force-curve-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding-top: 2px;
}

.force-metric-item {
    display: flex;
    flex-direction: column;
}

.force-metric-item.center-align {
    align-items: center;
    text-align: center;
}

.force-metric-item.right-align {
    align-items: flex-end;
}

.f-label {
    font-family: var(--font-mk);
    font-size: 0.62rem;
    font-weight: 800;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.f-val {
    font-family: var(--font-arcade);
    font-size: 1.15rem;
    font-weight: 900;
    color: #0F172A;
    line-height: 1.1;
}

.f-val small {
    font-family: var(--font-mk);
    font-size: 0.72rem;
    font-weight: 800;
    color: #64748B;
}

.force-phases-legend {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-dot {
    font-family: var(--font-mk);
    font-size: 0.60rem;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 6px;
    display: inline-block;
    line-height: 1.2;
}

.legend-dot.dot-legs {
    background: rgba(0, 200, 83, 0.16);
    color: #00873a;
    border: 1px solid rgba(0, 200, 83, 0.35);
}

.legend-dot.dot-trunk {
    background: rgba(0, 168, 255, 0.16);
    color: #0077b6;
    border: 1px solid rgba(0, 168, 255, 0.35);
}

.legend-dot.dot-arms {
    background: rgba(255, 170, 0, 0.18);
    color: #b37400;
    border: 1px solid rgba(255, 170, 0, 0.40);
}

.legend-dot.dot-prev {
    background: rgba(148, 163, 184, 0.16);
    color: #475569;
    border: 1px dashed rgba(148, 163, 184, 0.50);
}

/* Radar Minimap (Inferior Direito) */
.minimap-card {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--color-bg-dark);
    backdrop-filter: blur(14px);
    border: 2px solid var(--color-card-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.minimap-canvas {
    width: 100%;
    height: 100%;
}

.minimap-tag {
    position: absolute;
    bottom: 6px;
    font-size: 0.6rem;
    font-weight: 800;
    color: #A0B0C5;
    background: rgba(0, 0, 0, 0.65);
    padding: 2px 6px;
    border-radius: 8px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* ==========================================================================
   LEADERBOARD LATERAL COM HISTÓRICO SUPABASE
   ========================================================================== */
.leaderboard-drawer {
    position: absolute;
    right: 24px;
    top: 96px;
    width: 290px;
    background: var(--color-bg-dark);
    backdrop-filter: blur(18px);
    border: 1px solid var(--color-card-border);
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100vh - 270px);
    overflow-y: auto;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.leaderboard-title {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--color-primary);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    padding: 6px 10px;
    border-radius: 10px;
    transition: all 0.25s ease;
}

.leaderboard-item.is-player {
    background: rgba(0, 240, 255, 0.16);
    border-color: var(--color-primary);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
}

.leaderboard-item.is-ghost-record {
    background: rgba(255, 184, 0, 0.14);
    border-color: var(--color-warning);
    box-shadow: 0 0 10px rgba(255, 184, 0, 0.2);
}

.lb-left {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.lb-rank {
    font-family: var(--font-hud);
    font-size: 0.95rem;
    font-weight: 900;
    color: #FFFFFF;
    min-width: 14px;
}

.lb-avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
}

.leaderboard-item.is-player .lb-avatar-img {
    border-color: var(--color-primary);
}

.leaderboard-item.is-ghost-record .lb-avatar-img {
    border-color: var(--color-warning);
}

.lb-info-box {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    overflow: hidden;
}

.lb-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-record-badge {
    font-size: 0.62rem;
    font-weight: 800;
    color: var(--color-warning);
    letter-spacing: 0.4px;
}

.lb-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 65px;
}

.lb-gap {
    font-family: var(--font-hud);
    font-size: 0.85rem;
    font-weight: 800;
    color: #FFFFFF;
}

.lb-gap.ahead {
    color: var(--color-danger);
}

.lb-gap.behind {
    color: var(--color-accent);
}

.lb-gap.leader {
    color: var(--color-warning);
}

.lb-pace {
    font-size: 0.68rem;
    color: #8E9CAE;
}

/* Tags flutuantes dos barcos nas raias 3D */
.boat-3d-tag {
    position: absolute;
    transform: translate(-50%, -100%);
    background: rgba(10, 16, 28, 0.90);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    padding: 3px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 5;
}

.boat-3d-tag.is-ghost {
    border-color: var(--color-warning);
    box-shadow: 0 0 12px rgba(255, 184, 0, 0.35);
}

.boat-3d-tag-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.boat-3d-tag-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.boat-3d-tag-row1 {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.boat-3d-tag-name {
    font-family: var(--font-mk);
    font-size: 0.72rem;
    font-weight: 800;
    color: #FFFFFF;
}

.boat-3d-tag-gap {
    font-family: var(--font-hud);
    font-size: 0.80rem;
    font-weight: 900;
    color: #FFD700;
}

.boat-3d-tag-gap.behind {
    color: #38BDF8;
}

.boat-3d-tag-gap.ahead {
    color: #EF4444;
}

.boat-3d-tag-pace {
    font-family: var(--font-hud);
    font-size: 0.64rem;
    font-weight: 700;
    color: #CBD5E1;
    line-height: 1.0;
}

/* Efeito Especial de Espuma na Água para Barcos a mais de 50 metros */
.boat-3d-tag.water-foam {
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.92) 0%, rgba(2, 132, 199, 0.45) 50%, rgba(0, 240, 255, 0.0) 80%);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    box-shadow: none;
    padding: 6px 14px;
    border-radius: 20px;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    animation: waterFoamPulse 2.2s infinite ease-in-out;
}

@keyframes waterFoamPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1.0);
        filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.6));
    }
    50% {
        transform: translate(-50%, -50%) scale(1.12);
        filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 20px rgba(0, 240, 255, 0.9));
    }
}

.boat-3d-tag.water-foam .boat-3d-tag-avatar {
    display: none;
}

.boat-3d-tag.water-foam .boat-3d-tag-info {
    align-items: center;
}

.boat-3d-tag.water-foam .boat-3d-tag-row1 {
    gap: 8px;
}

.boat-3d-tag.water-foam .boat-3d-tag-name {
    font-family: var(--font-arcade);
    font-size: 1.0rem;
    color: #FFFFFF;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8), 0 0 8px #00F0FF, 0 0 14px #0284C7;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.boat-3d-tag.water-foam .boat-3d-tag-gap {
    font-family: var(--font-arcade);
    font-size: 1.05rem;
    font-weight: 900;
    color: #FFFFFF;
    text-shadow: 0 2px 4px rgba(0,0,0,0.9), 0 0 10px #FFD700;
}

.boat-3d-tag.water-foam .boat-3d-tag-gap.behind {
    color: #E0F2FE;
    text-shadow: 0 2px 4px rgba(0,0,0,0.9), 0 0 10px #00F0FF;
}

.boat-3d-tag.water-foam .boat-3d-tag-pace {
    font-family: var(--font-hud);
    font-size: 0.78rem;
    font-weight: 800;
    color: #FFFFFF;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8), 0 0 6px #00E5FF;
}

/* ==========================================================================
   MODAL DE SELEÇÃO DE ROTAS COM MAPA LEAFLET
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(14px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.modal-overlay.open {
    display: flex;
}

.modal-container {
    background: #0B111E;
    border: 1px solid var(--color-card-border);
    border-radius: 24px;
    width: 92%;
    max-width: 850px;
    max-height: 90vh;
    padding: 26px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 14px;
}

.modal-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #FFFFFF;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: #8E9CAE;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

/* Layout Split da Modal de Rotas */
.route-modal-container {
    max-width: 1040px !important;
    width: 95vw;
}

.route-modal-content {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 18px;
    height: 520px;
    max-height: 68vh;
    min-height: 0; /* IMPRESCINDÍVEL PARA SAFARI / WEBKIT */
}

@media (max-width: 860px) {
    .route-modal-content {
        grid-template-columns: 1fr;
        height: auto;
        max-height: 75vh;
    }
}

.route-cards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: scroll; /* Força ativação de scroll no Safari */
    -webkit-overflow-scrolling: touch;
    padding-right: 8px;
    min-height: 0; /* IMPRESCINDÍVEL PARA SAFARI / WEBKIT */
    height: 100%;
    max-height: 100%;
}

/* Scrollbars visíveis e estilizadas para Safari WebKit, Chrome e Firefox */
.route-cards-list::-webkit-scrollbar,
.leaderboard-drawer::-webkit-scrollbar {
    width: 6px;
    display: block !important;
}

.route-cards-list::-webkit-scrollbar-track,
.leaderboard-drawer::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.route-cards-list::-webkit-scrollbar-thumb,
.leaderboard-drawer::-webkit-scrollbar-thumb {
    background: #00F0FF;
    border-radius: 6px;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

.route-cards-list,
.leaderboard-drawer {
    scrollbar-width: thin;
    scrollbar-color: #00F0FF rgba(255, 255, 255, 0.05);
}

.route-card {
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid transparent;
    border-radius: 14px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0; /* IMPRESCINDÍVEL: impede que o Safari achate os cartões */
}

.route-card:hover {
    background: rgba(0, 240, 255, 0.08);
    border-color: rgba(0, 240, 255, 0.4);
}

.route-card.selected {
    background: rgba(0, 240, 255, 0.18);
    border-color: var(--color-primary);
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.3);
}

.rc-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.rc-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: #FFFFFF;
}

.rc-dist {
    font-family: var(--font-hud);
    font-size: 1rem;
    font-weight: 900;
    color: var(--color-primary);
}

.rc-desc {
    font-size: 0.74rem;
    color: #8E9CAE;
    line-height: 1.3;
}

.rc-tags {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.rc-tag {
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: #CAD8E8;
}

/* Wrapper do Mapa Leaflet */
.route-map-wrapper {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--color-card-border);
}

#leafletMap {
    width: 100%;
    height: 100%;
    background: #0A101C;
}

.route-map-info {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    background: rgba(8, 14, 24, 0.88);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-card-border);
    border-radius: 10px;
    padding: 8px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

.map-info-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: #FFFFFF;
}

.map-info-stats {
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 600;
}

/* Modal de Avatares */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    max-height: 380px;
    overflow-y: auto;
}

.avatar-card {
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid transparent;
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.avatar-card:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--color-primary);
}

.avatar-card.selected {
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--color-primary);
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.35);
}

.avatar-img-big {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-primary);
}

.avatar-card-name {
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
}

.avatar-card-tier {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--color-accent);
    background: rgba(57, 255, 20, 0.15);
    padding: 2px 6px;
    border-radius: 6px;
}

/* Estilos de Marcadores e Tooltips do Leaflet */
.leaflet-custom-marker {
    background: #0B111E;
    border: 2px solid #00F0FF;
    border-radius: 50%;
    box-shadow: 0 0 14px rgba(0, 240, 255, 0.6), 0 4px 10px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.leaflet-custom-marker:hover, .leaflet-custom-marker:active {
    transform: scale(1.2);
    box-shadow: 0 0 22px rgba(0, 240, 255, 0.9), 0 6px 14px rgba(0, 0, 0, 0.8);
    cursor: grabbing;
}

.leaflet-custom-marker.finish-marker {
    border-color: #FF3366;
    box-shadow: 0 0 14px rgba(255, 51, 102, 0.6), 0 4px 10px rgba(0, 0, 0, 0.6);
}

.leaflet-custom-marker.finish-marker:hover, .leaflet-custom-marker.finish-marker:active {
    box-shadow: 0 0 22px rgba(255, 51, 102, 0.9), 0 6px 14px rgba(0, 0, 0, 0.8);
}

.leaflet-tooltip {
    background: rgba(10, 16, 28, 0.92) !important;
    border: 1px solid rgba(0, 240, 255, 0.5) !important;
    color: #FFFFFF !important;
    font-family: var(--font-primary) !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
    padding: 3px 8px !important;
}

.leaflet-tooltip-top:before {
    border-top-color: rgba(0, 240, 255, 0.5) !important;
}

.rc-tag.custom-tag {
    background: rgba(255, 184, 0, 0.2);
    color: #FFB800;
    border: 1px solid rgba(255, 184, 0, 0.4);
}

.rc-tag.edited-tag {
    background: rgba(0, 240, 255, 0.18);
    color: #00F0FF;
    border: 1px solid rgba(0, 240, 255, 0.45);
}

/* Marcadores de Curva Náutica Intermediários (Waypoints) */
.leaflet-waypoint-marker {
    background: #FFFFFF;
    border: 2px solid #00F0FF;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.8), 0 2px 6px rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 900;
    color: #000;
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.leaflet-waypoint-marker:hover, .leaflet-waypoint-marker:active {
    transform: scale(1.35);
    background: #00F0FF;
    color: #000;
    box-shadow: 0 0 16px rgba(0, 240, 255, 1), 0 4px 10px rgba(0, 0, 0, 0.8);
    cursor: grabbing;
}

.rc-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rc-mini-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 0.7rem;
    color: #CAD8E8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rc-mini-btn:hover {
    background: rgba(0, 240, 255, 0.25);
    color: #FFF;
    border-color: #00F0FF;
}

/* ==========================================================================
   COLUNA LATERAL DIREITA UNIFICADA (RANKING + RADAR DA PROVA MARIO KART)
   ========================================================================== */
.right-hud-stack {
    position: absolute;
    right: 24px;
    top: 86px;
    width: 360px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.right-hud-stack > * {
    pointer-events: auto;
}

/* Oculta ranking quando qualquer modal ou tela de vitória estiver aberta */
body.modal-open .right-hud-stack,
body:has(.modal-overlay.open) .right-hud-stack,
body:has(.mario-finish-overlay:not([style*="display: none"])) .right-hud-stack {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.right-hud-stack .leaderboard-drawer {
    position: relative;
    right: auto;
    top: auto;
    width: 100%;
    flex: 0 0 auto;
    max-height: 440px;
    overflow-y: hidden;
    background: var(--color-bg-mk-card);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 2px solid var(--color-card-border);
    border-bottom: 4px solid var(--color-card-border-bottom);
    border-radius: 20px;
    padding: 8px 12px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.leaderboard-title {
    font-family: var(--font-arcade);
    font-size: 0.95rem;
    color: #E52521;
    letter-spacing: 0.5px;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    padding: 4px 9px;
    border-radius: 8px;
    min-height: 32px;
    transition: all 0.2s ease;
}

.leaderboard-item.is-player {
    background: #E0F2FE;
    border: 2px solid #0284C7;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.lb-left {
    display: flex;
    align-items: center;
    gap: 7px;
    overflow: hidden;
}

.lb-rank {
    font-family: var(--font-arcade);
    font-size: 1.0rem;
    color: #1E293B;
    min-width: 16px;
}

.lb-avatar-img {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.lb-name {
    font-family: var(--font-mk);
    font-size: 0.88rem;
    font-weight: 800;
    color: #1E293B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-item.is-player .lb-name {
    color: #0369A1;
    font-weight: 900;
}

.lb-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 120px;
    flex-shrink: 0;
}

.lb-gap {
    font-family: var(--font-hud);
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.1;
}

.lb-paces-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.74rem;
    line-height: 1.1;
    white-space: nowrap;
}

.lb-pace-current {
    font-weight: 800;
    color: #0284C7;
}

.lb-pace-avg {
    font-weight: 600;
    color: #64748B;
}

.leaderboard-item.is-player .lb-pace-current {
    color: #0369A1;
    font-weight: 900;
}

.lb-pace {
    font-size: 0.74rem;
    color: #64748B;
    line-height: 1.1;
}

/* Efeito hover na linha do ranking para feedback imediato */
.leaderboard-item {
    cursor: pointer;
}

.leaderboard-item:hover {
    background: #FFFFFF !important;
    border-color: #FACC15 !important;
    transform: translateX(-3px);
    box-shadow: 0 4px 12px rgba(250, 204, 21, 0.35);
}

.leaderboard-item.is-player:hover {
    background: #E0F2FE !important;
    border-color: #0284C7 !important;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
    transform: translateX(-3px);
}

/* Card Flutuante de Detalhes do Treino ao Passar o Mouse no Ranking (Hover Tooltip) */
/* Card Flutuante de Detalhes do Treino ao Passar o Mouse no Ranking (Hover Tooltip) */
.ranking-workout-tooltip {
    position: absolute;
    right: calc(100% + 14px);
    width: 335px;
    background: #FFFFFF;
    border: 2px solid #FACC15;
    border-bottom: 4px solid #CA8A04;
    border-radius: 16px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3), 0 2px 10px rgba(250, 204, 21, 0.25);
    padding: 12px 14px;
    z-index: 1000;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: tooltipPopLeft 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: right center;
    box-sizing: border-box;
}

@keyframes tooltipPopLeft {
    0% {
        opacity: 0;
        transform: translateX(10px) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Seta indicadora apontando dinamicamente para a linha do atleta no ranking */
.ranking-workout-tooltip::after {
    content: '';
    position: absolute;
    right: -10px;
    top: var(--arrow-top, 24px);
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 10px solid #FFFFFF;
    filter: drop-shadow(2px 0 1px rgba(202, 138, 4, 0.6));
    transition: top 0.12s ease;
}

.rw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1.5px solid #F1F5F9;
}

.rw-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.rw-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #FACC15;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.rw-athlete-name {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    color: #0F172A;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rw-boat-lane {
    font-size: 0.72rem;
    font-weight: 700;
    color: #0284C7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 175px;
}

.rw-badge-tag {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

.rw-badge-ghost {
    background: #F3E8FF;
    color: #7E22CE;
    border: 1px solid #D8B4FE;
}

.rw-badge-player {
    background: #E0F2FE;
    color: #0284C7;
    border: 1px solid #BAE6FD;
}

.rw-badge-bot {
    background: #FEF3C7;
    color: #B45309;
    border: 1px solid #FDE68A;
}

/* Grid de Informações: Data e Distância */
.rw-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 6px 10px;
}

.rw-meta-item {
    display: flex;
    flex-direction: column;
}

.rw-meta-label {
    font-size: 0.62rem;
    font-weight: 800;
    color: #64748B;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 3px;
}

.rw-meta-val {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.88rem;
    font-weight: 800;
    color: #0F172A;
    line-height: 1.2;
    margin-top: 1px;
}

.rw-meta-val.highlight {
    color: #E52521;
}

/* Área do Mini Gráfico de Splits /500m */
.rw-chart-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #FAF8F5;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 8px;
}

.rw-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rw-chart-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.74rem;
    font-weight: 800;
    color: #0F172A;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rw-chart-avg-badge {
    font-size: 0.68rem;
    font-weight: 800;
    color: #0284C7;
    background: #E0F2FE;
    padding: 1px 6px;
    border-radius: 6px;
}

.rw-chart-svg {
    width: 100%;
    height: 90px;
    overflow: visible;
}

/* Radar Náutico de Corrida Mario Kart & Mini-Mapa Real (Superior Esquerdo, Oposto ao Ranking) */
.mario-radar-card {
    position: absolute;
    left: 24px;
    top: 86px;
    width: 360px;
    background: var(--color-bg-mk-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 2px solid var(--color-card-border);
    border-bottom: 4px solid var(--color-card-border-bottom);
    border-radius: 20px;
    padding: 8px 12px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
    pointer-events: auto;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Oculta mapa quando modais ou vitória estiverem abertas */
body.modal-open .mario-radar-card,
body:has(.modal-overlay.open) .mario-radar-card,
body:has(.mario-finish-overlay:not([style*="display: none"])) .mario-radar-card {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.mario-radar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #E2E8F0;
    padding-bottom: 5px;
}

.map-radar-switch {
    display: flex;
    align-items: center;
    background: #E2E8F0;
    border-radius: 8px;
    padding: 2px;
    gap: 3px;
}

.switch-tab {
    font-family: var(--font-mk);
    font-size: 0.70rem;
    font-weight: 800;
    padding: 3px 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.switch-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.6);
    color: #0F172A;
}

.switch-tab.active {
    background: #E52521;
    color: #FFFFFF;
    box-shadow: 0 1px 4px rgba(229, 37, 33, 0.35);
}

.mario-radar-title {
    font-family: var(--font-arcade);
    font-size: 0.76rem;
    color: #E52521;
    letter-spacing: 0.5px;
}

.mario-radar-dist {
    font-family: var(--font-mk);
    font-size: 0.72rem;
    font-weight: 800;
    color: #475569;
}

.mario-radar-canvas-box {
    width: 100%;
    height: 195px;
    border-radius: 14px;
    background: linear-gradient(180deg, #E0F2FE 0%, #BAE6FD 100%);
    border: 1px solid #7DD3FC;
    overflow: hidden;
    position: relative;
}

#liveHudMap {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

#marioRadarCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Marcador dinâmico do barco no Mini-Mapa Real */
.hud-gps-player-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #0284C7;
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 8px rgba(2, 132, 199, 0.8), 0 2px 4px rgba(0,0,0,0.3);
    animation: gpsMarkerPulse 1.8s infinite ease-in-out;
}

@keyframes gpsMarkerPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 8px rgba(2, 132, 199, 0.8); }
    50% { transform: scale(1.18); box-shadow: 0 0 14px rgba(0, 240, 255, 1.0); }
}

.hud-gps-flag-marker {
    font-size: 15px;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}

/* Marcadores Leaflet dos 8 Personagens Mario Kart */
.mario-leaflet-marker {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0B111E;
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8), 0 2px 6px rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.mario-leaflet-marker.is-player-marker,
.mario-leaflet-marker.is-player {
    width: 34px;
    height: 34px;
    border: 3px solid #00F0FF;
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.9), 0 0 4px #FFFFFF;
    z-index: 1000 !important;
}

.mario-leaflet-marker img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hud-gps-bot-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #0B111E;
    border: 1.5px solid #FFFFFF;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.75);
    overflow: hidden;
    transition: transform 0.2s ease;
}

.hud-gps-bot-marker img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.hud-map-progress-badge {
    position: absolute;
    bottom: 8px;
    right: 10px;
    background: rgba(15, 23, 42, 0.88);
    border: 1.5px solid #00F0FF;
    border-radius: 20px;
    padding: 3px 10px;
    font-family: var(--font-arcade);
    font-size: 0.72rem;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 240, 255, 0.35), 0 2px 4px rgba(0,0,0,0.5);
    z-index: 10;
    pointer-events: none;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* ==========================================================================
   MODAL DE ELENCO MARIO KART (PADRÃO MARIO KART 8 ARCADE)
   ========================================================================== */
.mario-roster-modal {
    max-width: 1120px !important;
    width: 95vw !important;
    height: 88vh !important;
    max-height: 88vh !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    gap: 0 !important;
    background: #FFFFFF !important;
    border: 3px solid #FACC15 !important;
    border-bottom: 6px solid #CA8A04 !important;
    border-radius: 26px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 4px 16px rgba(234, 179, 8, 0.25) !important;
    overflow: hidden !important;
    position: relative;
    box-sizing: border-box;
}

/* Cabeçalho Fixo do Modal */
.mario-roster-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: #FFFFFF;
    border-bottom: 2px solid #E2E8F0;
    margin: 0;
}

.mario-roster-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mario-roster-header-icon {
    font-size: 1.8rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.mario-roster-title {
    font-family: 'Titan One', 'Fredoka', cursive, sans-serif;
    font-size: 1.45rem;
    letter-spacing: 0.5px;
    color: #E52521;
    text-shadow: 0 1px 2px rgba(229, 37, 33, 0.15);
    margin: 0;
    line-height: 1.15;
}

.mario-roster-subtitle {
    font-size: 0.78rem;
    color: #64748B;
    font-weight: 600;
    margin: 2px 0 0 0;
}

.mario-roster-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #F1F5F9;
    border: 2px solid #E2E8F0;
    color: #64748B;
    font-size: 1.4rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.mario-roster-close-btn:hover {
    background: #EF4444;
    border-color: #DC2626;
    color: #FFFFFF;
    transform: scale(1.08) rotate(90deg);
}

/* Corpo Rolável com Layout Split (2 Colunas) */
.mario-roster-modal .roster-split-layout {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 20px;
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 16px;
    align-items: stretch;
    margin: 0;
    background: #FAF8F5;
}

@media (max-width: 960px) {
    .mario-roster-modal .roster-split-layout {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar Estilo Mario Kart (Dourada / Amigável) */
.mario-roster-modal .roster-split-layout::-webkit-scrollbar {
    width: 8px;
}

.mario-roster-modal .roster-split-layout::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 8px;
}

.mario-roster-modal .roster-split-layout::-webkit-scrollbar-thumb {
    background: #FACC15;
    border: 2px solid #CA8A04;
    border-radius: 8px;
}

.mario-roster-modal .roster-split-layout::-webkit-scrollbar-thumb:hover {
    background: #EAB308;
}

/* Colunas do Layout */
.roster-col-player {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #FFFFFF;
    border: 2px solid #E2E8F0;
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.roster-col-opponents {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #FFFFFF;
    border: 2px solid #E2E8F0;
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.roster-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.92rem;
    font-weight: 800;
    color: #0F172A;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.roster-section-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: #FFFFFF;
    font-size: 0.78rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
}

.badge-lane-1 {
    background: #E52521;
}

.badge-opponents {
    background: #0284C7;
}

/* Box de Nome do Jogador */
.player-custom-name-box {
    background: #F8FAFC;
    border: 1.5px solid #E2E8F0;
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mario-player-name-label {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.8rem;
    font-weight: 800;
    color: #0F172A;
    display: block;
}

.mario-player-name-input {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 12px;
    background: #FFFFFF;
    border: 1.5px solid #CBD5E1;
    border-radius: 8px;
    color: #0F172A;
    font-size: 0.95rem;
    font-weight: 700;
    outline: none;
    transition: all 0.2s ease;
}

.mario-player-name-input:focus {
    border-color: #0284C7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Vitrine em Destaque do Piloto Selecionado (Hero Spotlight) */
.mario-hero-showcase {
    background: linear-gradient(135deg, #FFF1F2 0%, #EFF6FF 100%);
    border: 2px solid #BFDBFE;
    border-radius: 14px;
    padding: 10px 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

.mario-hero-media {
    position: relative;
    width: 86px;
    height: 86px;
    flex-shrink: 0;
}

.mario-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    border: 2.5px solid #E52521;
    box-shadow: 0 4px 12px rgba(229, 37, 33, 0.2);
}

.mario-hero-badge {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    background: #E52521;
    color: #FFFFFF;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.62rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1.5px solid #FFFFFF;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.mario-hero-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mario-hero-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
}

.mario-hero-name {
    font-family: 'Titan One', 'Fredoka', cursive, sans-serif;
    font-size: 1.25rem;
    color: #0F172A;
    margin: 0;
    letter-spacing: 0.3px;
}

.mario-hero-boat {
    font-size: 0.78rem;
    font-weight: 800;
    color: #0284C7;
    white-space: nowrap;
}

.mario-hero-desc {
    font-size: 0.72rem;
    color: #475569;
    margin: 0;
    line-height: 1.3;
}

.mario-hero-stats {
    display: flex;
    gap: 12px;
    margin-top: 3px;
}

.mario-hero-stat {
    display: flex;
    flex-direction: column;
}

.mario-hero-stat .stat-label {
    font-size: 0.58rem;
    font-weight: 800;
    color: #64748B;
    text-transform: uppercase;
}

.mario-hero-stat .stat-val {
    font-size: 0.82rem;
    font-weight: 800;
    color: #0F172A;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Grid Seletor de Personagens (4 colunas x 2 linhas) */
.mario-character-selector-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.mario-char-card {
    background: #FFFFFF;
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    padding: 5px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: center;
    overflow: hidden;
}

.mario-char-card:hover {
    background: #FFFBEB;
    border-color: #F59E0B;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.mario-char-card.selected {
    background: #FEF2F2;
    border-color: #E52521;
    border-width: 2.5px;
    box-shadow: 0 0 0 3px rgba(229, 37, 33, 0.25);
    transform: scale(1.02);
}

.mario-char-img {
    width: 100%;
    height: 54px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #E2E8F0;
    transition: transform 0.2s ease;
}

.mario-char-card:hover .mario-char-img {
    transform: scale(1.03);
}

.mario-char-card.selected .mario-char-img {
    border-color: #E52521;
}

.mario-char-name {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.74rem;
    font-weight: 800;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    margin-top: 1px;
}

.mario-char-role {
    font-size: 0.60rem;
    font-weight: 600;
    color: #64748B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Lista de Adversários (Raias 2 a 8) */
.opponents-roster-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: visible;
    padding-right: 0;
}

.opponent-roster-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #F8FAFC;
    border: 1.5px solid #E2E8F0;
    border-radius: 12px;
    padding: 5px 10px;
    height: 52px;
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.opponent-roster-row:hover {
    background: #FFFFFF;
    border-color: #CBD5E1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.opponent-roster-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 200px;
    min-width: 0;
}

.opponent-roster-lane {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.72rem;
    font-weight: 900;
    background: #FEF3C7;
    color: #B45309;
    border: 1px solid #FDE68A;
    border-radius: 6px;
    padding: 2px 6px;
    min-width: 44px;
    text-align: center;
    flex-shrink: 0;
}

.opponent-roster-img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    border: 1.5px solid #CBD5E1;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.opponent-roster-info {
    min-width: 0;
    overflow: hidden;
}

.opponent-roster-char-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.76rem;
    color: #0F172A;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.opponent-roster-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    justify-content: flex-end;
}

.opponent-roster-input {
    width: 100px;
    flex-shrink: 0;
    padding: 5px 8px;
    background: #FFFFFF;
    border: 1.5px solid #CBD5E1;
    border-radius: 8px;
    color: #0F172A;
    font-size: 0.78rem;
    font-weight: 700;
    outline: none;
    transition: all 0.2s ease;
}

.opponent-roster-input:focus {
    border-color: #0284C7;
    background: #FFFFFF;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.opponent-ghost-select {
    flex: 1;
    min-width: 140px;
    max-width: 220px;
    padding: 5px 8px;
    background: #FFFFFF;
    border: 1.5px solid #CBD5E1;
    border-radius: 8px;
    color: #0F172A;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    outline: none;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
}

.opponent-ghost-select:focus {
    border-color: #F59E0B;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.opponent-ghost-select option {
    background: #FFFFFF;
    color: #0F172A;
}

/* Rodapé Fixo do Modal */
.mario-roster-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: #FFFFFF;
    border-top: 2px solid #E2E8F0;
    margin: 0;
}

.mario-roster-btn-auto {
    height: 44px;
    padding: 0 18px;
    background: linear-gradient(180deg, #FDE047 0%, #EAB308 100%);
    color: #713F12;
    border: 2px solid #CA8A04;
    border-bottom: 4px solid #A16207;
    border-radius: 12px;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.88rem;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 3px 8px rgba(202, 138, 4, 0.3);
    transition: all 0.15s ease;
}

.mario-roster-btn-auto:hover {
    background: linear-gradient(180deg, #FEF08A 0%, #FACC15 100%);
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(202, 138, 4, 0.4);
}

.mario-roster-btn-auto:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: none;
}

.mario-roster-btn-save {
    flex: 1;
    height: 44px;
    padding: 0 24px;
    background: linear-gradient(180deg, #22C55E 0%, #16A34A 100%);
    color: #FFFFFF;
    border: 2px solid #15803D;
    border-bottom: 4px solid #14532D;
    border-radius: 12px;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.96rem;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 3px 10px rgba(22, 163, 74, 0.35);
    transition: all 0.15s ease;
}

.mario-roster-btn-save:hover {
    background: linear-gradient(180deg, #4ADE80 0%, #22C55E 100%);
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(22, 163, 74, 0.45);
}

.mario-roster-btn-save:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: none;
}

.ghost-badge-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(168, 85, 247, 0.25);
    border: 1px solid rgba(168, 85, 247, 0.6);
    color: #E9D5FF;
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 0.62rem;
    font-weight: 800;
    margin-left: 4px;
}

.lb-item.is-ghost {
    border-left: 3px solid #A855F7;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.9); }
}

/* ==========================================================================
   OVERLAY DE VITÓRIA & COROAÇÃO ESTILO MARIO KART 🏆🏁
   ========================================================================== */
.mario-finish-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, rgba(10, 20, 38, 0.85) 0%, rgba(5, 10, 20, 0.95) 100%);
    backdrop-filter: blur(8px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInFinish 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.mario-confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.mario-finish-modal {
    position: relative;
    z-index: 10000;
    max-width: 580px;
    width: 90%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: modalPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Banner de Chegada Estilo Mario Kart */
.mario-finish-banner-container {
    margin-bottom: 18px;
    transform: perspective(600px) rotateX(8deg);
}

.mario-finish-banner-text {
    font-family: var(--font-hud);
    font-size: 3.6rem;
    font-weight: 900;
    font-style: italic;
    letter-spacing: 2px;
    background: linear-gradient(180deg, #FFF000 0%, #FF8800 60%, #E52521 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 16px rgba(255, 136, 0, 0.75)) drop-shadow(0 2px 4px #000);
    text-transform: uppercase;
    animation: bannerSlam 0.6s cubic-bezier(0.2, 0.8, 0.2, 1.2) forwards;
}

.mario-finish-sub-banner {
    font-family: var(--font-hud);
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: #00F0FF;
    text-transform: uppercase;
    margin-top: -4px;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

/* Card de Pódio e Coroação */
.mario-coronation-card {
    background: linear-gradient(135deg, rgba(16, 28, 52, 0.95) 0%, rgba(10, 18, 32, 0.98) 100%);
    border: 2px solid rgba(255, 215, 0, 0.55);
    box-shadow: 0 0 35px rgba(255, 215, 0, 0.35), inset 0 0 20px rgba(0, 240, 255, 0.12);
    border-radius: 20px;
    padding: 24px 28px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.coronation-avatar-wrapper {
    position: relative;
    width: 96px;
    height: 96px;
    margin-top: -10px;
    margin-bottom: 12px;
}

.coronation-crown-icon {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2.5rem;
    filter: drop-shadow(0 0 12px #FFD700);
    animation: crownFloat 2s ease-in-out infinite alternate;
    z-index: 2;
}

.coronation-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.coronation-rank-badge {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: linear-gradient(135deg, #FFD700, #FF8C00);
    color: #000;
    font-family: var(--font-hud);
    font-size: 0.95rem;
    font-weight: 900;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.coronation-player-name {
    font-family: var(--font-hud);
    font-size: 1.5rem;
    font-weight: 800;
    color: #FFFFFF;
    margin: 0 0 4px 0;
}

.coronation-rank-title {
    font-family: var(--font-hud);
    font-size: 1.05rem;
    font-weight: 800;
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    margin-bottom: 18px;
}

/* Grid com Estatísticas Oficiais */
.coronation-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    margin-bottom: 22px;
}

.coronation-stat-box {
    background: rgba(0, 240, 255, 0.06);
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.2s ease;
}

.coronation-stat-box:hover {
    background: rgba(0, 240, 255, 0.12);
    border-color: #00F0FF;
}

.coronation-stat-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #8E9CAE;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.coronation-stat-value {
    font-family: var(--font-hud);
    font-size: 1.35rem;
    font-weight: 800;
    color: #00F0FF;
}

.coronation-stat-value small {
    font-size: 0.72rem;
    color: #A0B0C5;
}

/* Ações do Pódio */
.coronation-actions {
    display: flex;
    gap: 12px;
    width: 100%;
}

.coronation-btn {
    flex: 1;
    height: 46px;
    border-radius: 10px;
    font-family: var(--font-hud);
    font-size: 0.85rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.coronation-btn.cooldown-btn {
    background: rgba(0, 240, 255, 0.15);
    border: 1px solid #00F0FF;
    color: #00F0FF;
}

.coronation-btn.cooldown-btn:hover {
    background: #00F0FF;
    color: #000;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
    transform: translateY(-2px);
}

.coronation-btn.finish-btn {
    background: linear-gradient(135deg, #E52521, #FF3366);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 14px rgba(229, 37, 33, 0.4);
}

.coronation-btn.finish-btn:hover {
    background: linear-gradient(135deg, #FF3366, #FF5588);
    box-shadow: 0 0 20px rgba(255, 51, 102, 0.6);
    transform: translateY(-2px);
}

/* Badge Flutuante de Desaquecimento (HUD do Cockpit) */
.cooldown-hud-badge {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 22, 42, 0.92);
    border: 1px solid #00F0FF;
    box-shadow: 0 0 18px rgba(0, 240, 255, 0.35);
    border-radius: 30px;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    backdrop-filter: blur(8px);
    animation: slideDownBadge 0.4s ease forwards;
}

.cooldown-pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #00F0FF;
    box-shadow: 0 0 10px #00F0FF;
    animation: pulse 1.5s infinite;
}

.cooldown-hud-content {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.cooldown-hud-title {
    font-size: 0.65rem;
    font-weight: 800;
    color: #00F0FF;
    letter-spacing: 1px;
}

.cooldown-hud-dist {
    font-family: var(--font-hud);
    font-size: 0.85rem;
    font-weight: 800;
    color: #FFFFFF;
}

.cooldown-mini-btn {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid #FFD700;
    color: #FFD700;
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cooldown-mini-btn:hover {
    background: #FFD700;
    color: #000;
}

.cooldown-stop-btn {
    background: rgba(229, 37, 33, 0.25);
    border: 1px solid #E52521;
    color: #FF5555;
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cooldown-stop-btn:hover {
    background: #E52521;
    color: #FFF;
}

/* Animações Keyframes */
@keyframes bannerSlam {
    0% { transform: scale(3.5); opacity: 0; }
    50% { transform: scale(0.9); opacity: 1; }
    75% { transform: scale(1.08); }
    100% { transform: scale(1.0); opacity: 1; }
}

@keyframes crownFloat {
    0% { transform: translateX(-50%) translateY(0px) rotate(-4deg); }
    100% { transform: translateX(-50%) translateY(-6px) rotate(4deg); }
}

@keyframes fadeInFinish {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalPopIn {
    0% { transform: scale(0.7) translateY(40px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes slideDownBadge {
    0% { transform: translateX(-50%) translateY(-30px); opacity: 0; }
    100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ==========================================================================
   MODAL DE PERFIS DE ATLETAS & BIOMECÂNICA DE AMPLITUDE
   ========================================================================== */
.athlete-modal-container {
    max-width: 760px;
    width: 95%;
    background: #FFFFFF;
    border-radius: 28px;
    border: 3px solid #38BDF8;
    border-bottom: 6px solid #0284C7;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: var(--font-mk);
    animation: modalPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.athlete-modal-container .modal-header {
    border-bottom: 2px solid #E2E8F0;
    padding-bottom: 12px;
}

.athlete-modal-container .modal-title {
    font-size: 1.35rem;
    font-weight: 900;
    color: #0F172A;
}

.athlete-modal-container .modal-close-btn {
    background: #F1F5F9;
    border: 1px solid #CBD5E1;
    color: #64748B;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.athlete-modal-container .modal-close-btn:hover {
    background: #E2E8F0;
    color: #0F172A;
}

.athlete-profiles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.athlete-profile-card {
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-bottom: 4px solid #CBD5E1;
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.athlete-profile-card:hover {
    transform: translateY(-2px);
    border-color: #93C5FD;
}

.athlete-profile-card.active-selected {
    background: #F0F9FF;
    border: 2px solid #0284C7;
    border-bottom: 4px solid #0369A1;
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.18);
}

.athlete-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.athlete-card-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 3px solid #38BDF8;
    object-fit: cover;
    background: #0F172A;
}

.athlete-card-title-group {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.athlete-card-name {
    font-size: 1.15rem;
    font-weight: 900;
    color: #0F172A;
}

.athlete-card-badge {
    font-family: var(--font-arcade);
    font-size: 0.72rem;
    font-weight: 800;
    color: #0284C7;
    text-transform: uppercase;
}

.athlete-profile-card.active-selected .athlete-card-badge {
    color: #059669;
    font-weight: 900;
}

.athlete-inputs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.athlete-input-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.athlete-input-field label {
    font-size: 0.72rem;
    font-weight: 800;
    color: #64748B;
    text-transform: uppercase;
}

.athlete-input-field input, .athlete-input-field select {
    background: #FFFFFF;
    border: 1.5px solid #CBD5E1;
    border-radius: 12px;
    padding: 7px 8px;
    font-family: var(--font-arcade);
    font-size: 0.88rem;
    font-weight: 900;
    color: #0F172A;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.athlete-input-field input:focus, .athlete-input-field select:focus {
    border-color: #0284C7;
}

.athlete-modal-info-box {
    background: #EFF6FF;
    border: 1.5px solid #BFDBFE;
    border-radius: 16px;
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #1E3A8A;
    font-size: 0.82rem;
    line-height: 1.4;
}

.athlete-modal-info-box .info-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.athlete-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid #E2E8F0;
}



