/* Estilos personalizados para Mobile App */

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
}

/* Prevenir zoom no iOS */
input,
select,
textarea {
    font-size: 16px !important;
}

/* Bottom Navigation */
#bottom-nav {
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-item.active {
    color: #2563eb;
}

/* Camera Preview */
#camera-video {
    /* Por padrão não espelha; o espelhamento é aplicado via JS somente na câmera frontal. */
    -webkit-transform: scaleX(1);
    transform: scaleX(1);
    /* Permite rolar a página com gestos mesmo enquanto o dedo está sobre o vídeo (principalmente no iOS). */
    touch-action: pan-y;
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Safe area for iOS notch */
body {
    padding-bottom: env(safe-area-inset-bottom);
}

#bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
}

/* Touch feedback */
button:active,
.cursor-pointer:active {
    opacity: 0.7;
}

/* Prevent pull-to-refresh on iOS */
body {
    overscroll-behavior-y: contain;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* SweetAlert2: acima do overlay global (#loading-overlay), da bottom nav e do modal do ranking (#delivery-race-modal ~100050) */
.swal2-container {
    z-index: 100100 !important;
}

/* SweetAlert2 customizations – padding inferior em todos os modais */
.swal2-popup {
    border-radius: 1rem !important;
    overflow: hidden !important;
    padding: 0 !important;
    padding-bottom: 1.5rem !important;
}

.swal2-actions {
    margin-bottom: 0 !important;
    padding-bottom: 0.5rem !important;
}

.swal-detalhes-beneficiario.swal2-popup {
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.swal2-title {
    font-size: 1rem !important;
    font-weight: 500 !important;
    padding-right: 2rem;
}

/* Header do modal Detalhes do Beneficiário: fundo azul escuro, texto e X brancos */
.swal-detalhes-beneficiario .swal2-header {
    background-color: #1e3a8a !important;
    padding: 1rem 1.5rem !important;
    margin: 0 !important;
    border-radius: 1rem 1rem 0 0 !important;
    position: relative !important;
}

.swal-detalhes-beneficiario .swal2-title {
    font-weight: 400 !important;
    font-size: 1rem !important;
    color: #ffffff !important;
    text-align: center !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 2rem !important;
    box-sizing: border-box !important;
    background: transparent !important;
}

.swal-detalhes-beneficiario .swal2-close {
    position: absolute !important;
    right: 1rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    color: #ffffff !important;
    width: 2rem !important;
    height: 2rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0.9 !important;
    background: transparent !important;
    font-size: 2rem !important;
    line-height: 1 !important;
}

.swal-detalhes-beneficiario .swal2-close:hover {
    color: #ffffff !important;
    opacity: 1 !important;
    background: transparent !important;
}

.swal-detalhes-beneficiario .swal2-close:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Body e Footer do modal Detalhes do Beneficiário */
.swal-detalhes-beneficiario .swal2-html-container {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
}

.swal-detalhes-beneficiario .swal-modal-body {
    padding: 1.5rem;
    text-align: left;
}

.swal-detalhes-beneficiario .swal-modal-footer {
    display: block;
    padding: 1rem;
    margin: 1.5rem 0 0 0;
    background: #ffffff;
    width: 100%;
}

.swal-detalhes-beneficiario .swal-modal-footer button {
    border-radius: 0.5rem;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

/* Modal de confirmação de entrega */
.swal-confirm-entrega.swal2-popup {
    padding: 1.75rem 1.5rem !important;
}

/* Modal Senha Gerada: espaço na parte inferior */
.swal-senha-gerada.swal2-popup {
    padding-bottom: 2rem !important;
}

.swal-senha-gerada .swal2-actions {
    margin-bottom: 0 !important;
    padding-bottom: 0.5rem !important;
}

.swal-confirm-entrega .swal2-title {
    padding: 0 0.5rem;
    margin-bottom: 0.5rem;
}

.swal-confirm-entrega .swal2-html-container {
    margin-top: 0.25rem;
    margin-bottom: 1.25rem;
}

.swal-confirm-entrega .swal2-actions {
    gap: 0.75rem;
    margin-top: 0;
}

/* Botão close sem aparecer "marcado" ao abrir o modal */
.swal2-close:focus,
.swal2-close-no-focus:focus {
    outline: none !important;
    box-shadow: none !important;
}

.swal2-confirm {
    background-color: #2563eb !important;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
}

.swal2-cancel {
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
}

/* Alpine transitions */
[x-cloak] {
    display: none !important;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* PWA Install Button */
.install-prompt {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 50;
}

/* ========== Corrida / ranking (modal jogo — claro e animado) ========== */
#delivery-race-modal {
    background: linear-gradient(180deg, #7dd3fc 0%, #a7f3d0 45%, #fde68a 100%);
}

/* Aberto via JS: garante visível por cima de tudo (Tailwind hidden + PWA / stacking). */
#delivery-race-modal.sigvsa-race-modal--open {
    display: flex !important;
    flex-direction: column;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483000 !important;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-overflow-scrolling: touch;
}

/* Mapa ao vivo: deve ficar acima do ranking em tela cheia (#delivery-race-modal.sigvsa-race-modal--open = 2147483000). */
#delivery-ranking-map-modal {
    z-index: 2147483010 !important;
}

/* Mapa expandido: painel ocupa a viewport (sobre o ranking). */
#delivery-ranking-map-modal.delivery-ranking-map--expanded {
    align-items: stretch !important;
    justify-content: stretch !important;
    padding: 0 !important;
}

#delivery-ranking-map-modal.delivery-ranking-map--expanded #delivery-ranking-map-panel {
    max-width: none;
    width: 100%;
    max-height: none;
    height: 100%;
    min-height: 100dvh;
    min-height: 100vh;
    border-radius: 0;
    border-width: 0;
}

#delivery-ranking-map-modal.delivery-ranking-map--expanded #delivery-ranking-map-canvas {
    min-height: 0 !important;
    flex: 1 1 auto;
}

/* Seletor de camadas (igual ideia da VGS): alvo de toque maior no mobile */
#delivery-ranking-map-modal .leaflet-control-layers {
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
#delivery-ranking-map-modal .leaflet-control-layers-toggle {
    width: 40px !important;
    height: 40px !important;
    touch-action: manipulation;
}

/* Marcador Leaflet customizado (ranking / mapa ao vivo) */
.leaflet-div-icon.delivery-ranking-map-marker-icon {
    background: transparent !important;
    border: none !important;
}

/* Pulso e núcleo: centro compartilhado; cor via --ranking-track-color (lane_color). */
.delivery-ranking-map-marker-root {
    position: relative;
    width: 44px;
    height: 44px;
    pointer-events: none;
    --ranking-track-color: #f97316;
}

.delivery-ranking-map-marker-pulse {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 36px;
    height: 36px;
    margin-left: -18px;
    margin-top: -18px;
    border-radius: 50%;
    background: var(--ranking-track-color);
    transform-origin: center center;
    animation: sigvsa-ranking-map-marker-pulse 2.1s ease-out infinite;
    z-index: 1;
}

.delivery-ranking-map-marker-core {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--ranking-track-color);
    border: 3px solid #fff;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.35);
    z-index: 2;
}

@keyframes sigvsa-ranking-map-marker-pulse {
    0% {
        transform: scale(0.5);
        opacity: 0.95;
    }
    100% {
        transform: scale(1.65);
        opacity: 0;
    }
}

/* Mapa coletivo: pulso + avatar na cor da pista (lane_color) */
.leaflet-div-icon.delivery-ranking-fleet-marker-icon {
    background: transparent !important;
    border: none !important;
}

.delivery-ranking-fleet-marker-root {
    position: relative;
    width: 44px;
    height: 44px;
}

.delivery-ranking-fleet-marker-pulse {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 34px;
    height: 34px;
    margin-left: -17px;
    margin-top: -17px;
    border-radius: 50%;
    background: var(--fleet-track-color, #f97316);
    transform-origin: center center;
    animation: sigvsa-ranking-map-marker-pulse 2.1s ease-out infinite;
    z-index: 1;
    pointer-events: none;
}

.delivery-ranking-fleet-marker.delivery-ranking-fleet-marker--inner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #fff;
    box-shadow:
        0 0 0 1px var(--fleet-track-color, #f97316),
        0 2px 10px rgba(15, 23, 42, 0.28);
    background: #94a3b8;
    z-index: 2;
}

.delivery-ranking-fleet-marker--inner--photo {
    overflow: hidden;
}

.delivery-ranking-fleet-marker__photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 2;
}

.delivery-ranking-fleet-marker__initials-fallback {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    color: #fff;
    background: var(--fleet-track-color, #f97316);
}

.delivery-ranking-fleet-marker__initials-fallback:not([hidden]) {
    display: flex;
}

.delivery-ranking-fleet-marker--inner.delivery-ranking-fleet-marker--initials {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    color: #fff;
    background: var(--fleet-track-color, #f97316);
}

/* Céu/nuvens atrás do conteúdo (antes podiam cobrir header/body por stacking ambíguo). */
#delivery-race-main-layer {
    position: relative;
    z-index: 1;
}

.race-game-sky,
.race-game-clouds {
    z-index: 0;
}

#delivery-race-main-layer > header,
#delivery-race-main-layer > #delivery-race-body,
#delivery-race-main-layer > footer {
    position: relative;
    z-index: 2;
}

.race-game-sky {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, transparent 40%);
    animation: race-sky-pulse 8s ease-in-out infinite;
}

@keyframes race-sky-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

.race-game-clouds {
    position: absolute;
    left: 0;
    right: 0;
    top: 10%;
    height: 120px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120'%3E%3Cellipse cx='200' cy='60' rx='90' ry='40' fill='white' opacity='0.55'/%3E%3Cellipse cx='280' cy='55' rx='70' ry='35' fill='white' opacity='0.5'/%3E%3Cellipse cx='600' cy='50' rx='100' ry='45' fill='white' opacity='0.45'/%3E%3Cellipse cx='900' cy='65' rx='85' ry='38' fill='white' opacity='0.5'/%3E%3C/svg%3E")
        repeat-x;
    background-size: 600px 120px;
    animation: race-clouds-drift 45s linear infinite;
    opacity: 0.9;
}

@keyframes race-clouds-drift {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-600px);
    }
}

.race-game-root {
    position: relative;
    border-radius: 1.25rem;
    /* visible: halo do bump (box-shadow) não pode ser cortado */
    overflow: visible;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
    border: 3px solid rgba(255, 255, 255, 0.85);
}

.race-game-track-wrap {
    position: relative;
    padding: 0.5rem 0.75rem 0.75rem 0.5rem;
    background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
}

.race-game-lanes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.race-game-lane {
    position: relative;
    height: 3.25rem;
    border-radius: 9999px;
    overflow: visible;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.06);
    transition:
        opacity 0.2s ease,
        filter 0.2s ease,
        box-shadow 0.2s ease;
}

/* Quem não participa identificado: mais apagado para destacar quem mostra nome/foto. */
.race-game-lane--dimmed {
    opacity: 0.52;
    filter: saturate(0.55) brightness(0.92);
}

.race-game-lane--dimmed .race-game-lane-inner {
    opacity: 0.75;
}

.race-game-lane--identified {
    opacity: 1;
    filter: none;
}

/* Sua faixa (“Você”): anel azul — só aparece na linha do usuário logado, não é bug do bump */
.race-game-lane--self {
    opacity: 1 !important;
    filter: none !important;
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.95),
        0 0 0 4px rgba(37, 99, 235, 0.38),
        0 6px 18px rgba(37, 99, 235, 0.32);
}

.race-game-name--self {
    font-weight: 800;
    color: #1e3a8a;
    letter-spacing: 0.02em;
}

.race-game-lane-inner {
    position: absolute;
    inset: 0;
    z-index: 2;
    /* Não roubar toque/clique: o sheen fica só visual; senão o tap no avatar não chega ao runner. */
    pointer-events: none;
    border-radius: 9999px;
    background: repeating-linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.35) 0px,
        rgba(255, 255, 255, 0.35) 12px,
        transparent 12px,
        transparent 24px
    );
    animation: race-stripes 1.2s linear infinite;
}

@keyframes race-stripes {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 48px 0;
    }
}

.race-game-runner {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: left 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Animação no wrap: evita “quadrado” atrás do círculo (rotate + overflow no mesmo nó). */
.race-game-avatar-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: race-runner-wobble 0.6s ease-in-out infinite alternate;
}

.race-game-avatar-wrap--map-target {
    cursor: pointer;
    touch-action: manipulation;
    position: relative;
    z-index: 6;
}

.race-game-avatar {
    position: relative;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    background: #fff;
}

/* Iniciais atrás; foto por cima. Erro no carregamento → .race-game-avatar-fallback--visible + img--failed */
.race-game-avatar-fallback {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    color: #fff;
    border-radius: 9999px;
}

.race-game-avatar-fallback--visible {
    display: flex;
}

.race-game-avatar-img {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 9999px;
}

.race-game-avatar-img--failed {
    display: none !important;
}

@keyframes race-runner-wobble {
    0% {
        transform: rotate(-4deg) translateY(0);
    }
    100% {
        transform: rotate(4deg) translateY(-2px);
    }
}

.race-game-score-wrap {
    position: relative;
    margin-top: 2px;
    display: flex;
    justify-content: center;
    min-width: 2rem;
    min-height: 1.15rem;
}

.race-game-score {
    margin-top: 0;
    min-width: 1.75rem;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 900;
    color: #0f172a;
    background: #fff;
    border-radius: 9999px;
    padding: 0.1rem 0.35rem;
    border: 2px solid rgba(15, 23, 42, 0.12);
    box-shadow: 0 2px 0 rgba(15, 23, 42, 0.08);
}

/* Nova senha: brilho na borda + faixa (~3s). --race-track-color vem do inline da pista. */
.race-game-lane--bump {
    z-index: 8;
}

/* Halo fora da pista (abaixo das listras para não cobrir o efeito listrado). */
.race-game-lane--bump::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 9999px;
    pointer-events: none;
    z-index: 1;
    background: transparent;
    opacity: 0;
    /* branco + cor da pista (fallback se não houver variável) */
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.98),
        0 0 0 1px color-mix(in srgb, var(--race-track-color, #f97316) 55%, white),
        0 0 18px 8px color-mix(in srgb, var(--race-track-color, #f97316) 45%, transparent),
        0 0 36px 14px color-mix(in srgb, var(--race-track-color, #f97316) 28%, transparent),
        0 0 52px 20px rgba(255, 255, 255, 0.2);
    animation: race-lane-bump-border-glow 3s ease-in-out forwards;
}

@supports not (color: color-mix(in srgb, red, blue)) {
    .race-game-lane--bump::before {
        box-shadow:
            0 0 0 2px rgba(255, 255, 255, 0.98),
            0 0 20px 10px rgba(249, 115, 22, 0.45),
            0 0 40px 18px rgba(255, 255, 255, 0.35),
            0 0 56px 22px rgba(255, 200, 120, 0.2);
    }
}

@keyframes race-lane-bump-border-glow {
    0% {
        opacity: 0;
        transform: scale(0.97);
    }
    14% {
        opacity: 1;
        transform: scale(1);
    }
    45% {
        opacity: 1;
        transform: scale(1.01);
    }
    82% {
        opacity: 0.72;
    }
    100% {
        opacity: 0;
        transform: scale(1);
    }
}

.race-game-lane--bump::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    pointer-events: none;
    z-index: 3;
    background: linear-gradient(
        105deg,
        rgba(255, 255, 255, 0) 0%,
        color-mix(in srgb, var(--race-track-color, #f97316) 22%, rgba(255, 255, 255, 0.75)) 42%,
        rgba(255, 255, 255, 0.12) 100%
    );
    opacity: 0;
    mix-blend-mode: soft-light;
    animation: race-lane-bump-sheen 3s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

@supports not (color: color-mix(in srgb, red, blue)) {
    .race-game-lane--bump::after {
        background: linear-gradient(
            105deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.72) 45%,
            rgba(255, 255, 255, 0.18) 100%
        );
        mix-blend-mode: normal;
    }
}

@keyframes race-lane-bump-sheen {
    0% {
        opacity: 0;
        transform: translateX(-12%) scaleX(0.92);
    }
    15% {
        opacity: 1;
    }
    45% {
        opacity: 0.95;
        transform: translateX(18%) scaleX(1);
    }
    70% {
        opacity: 0.55;
        transform: translateX(28%) scaleX(1);
    }
    100% {
        opacity: 0;
        transform: translateX(38%) scaleX(1);
    }
}

.race-game-score--pop {
    animation: race-score-pop 0.58s cubic-bezier(0.34, 1.45, 0.64, 1);
}

@keyframes race-score-pop {
    0% {
        transform: scale(1);
    }
    28% {
        transform: scale(1.22);
    }
    100% {
        transform: scale(1);
    }
}

/* Partículas “+”: sobem e vão crescendo (~1.45s); fluxo contínuo por ~3s no JS */
.race-game-particle {
    position: absolute;
    left: 50%;
    bottom: 50%;
    font-size: 11px;
    font-weight: 950;
    line-height: 1;
    color: var(--particle-color, #0ea5e9);
    text-shadow:
        0 0 8px rgba(255, 255, 255, 1),
        0 1px 2px rgba(15, 23, 42, 0.35);
    pointer-events: none;
    z-index: 20;
    opacity: 0;
    will-change: transform, opacity;
    animation: race-score-particle-burst 1.45s cubic-bezier(0.28, 0.85, 0.42, 1) forwards;
}

@keyframes race-score-particle-burst {
    0% {
        opacity: 0;
        transform: translate(-50%, 6px) scale(0.38) rotate(-3deg);
    }
    10% {
        opacity: 1;
    }
    78% {
        opacity: 0.9;
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--tx, 0px)), var(--ty, -72px)) scale(1.52) rotate(2deg);
    }
}

/* Medalhas (1º, 2º, 3º) no ranking do dia */
.race-game-medal {
    position: absolute;
    top: 50%;
    right: 0.6rem;
    transform: translateY(-50%);
    z-index: 6;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 950;
    border: 0;
    pointer-events: none;
    background: transparent;
}

.race-game-medal-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.race-game-medal--gold {
    background: transparent;
    color: inherit;
}

.race-game-medal--silver {
    background: transparent;
    color: inherit;
}

.race-game-medal--bronze {
    background: transparent;
    color: inherit;
}

/* Indicador de online no avatar do ranking */
.race-online-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 9999px;
    background: #94a3b8;
    border: 2px solid #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    z-index: 10;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.race-online-indicator--active {
    opacity: 1;
    transform: scale(1);
    background: #22c55e;
    animation: race-online-pulse 2s ease-in-out infinite;
}

@keyframes race-online-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }
    50% {
        box-shadow: 0 0 0 3px rgba(34, 197, 94, 0);
    }
}

.race-game-name {
    position: absolute;
    left: 0.75rem;
    right: 3.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(15, 23, 42, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
    /* acima do sheen do bump (::after z-index 3) */
    z-index: 5;
    pointer-events: none;
}

.race-loading-pulse {
    animation: race-loading-pulse 1s ease-in-out infinite;
}

@keyframes race-loading-pulse {
    0%,
    100% {
        opacity: 0.55;
    }
    50% {
        opacity: 1;
    }
}

#btn-delivery-race {
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.45);
    right: 0.75rem;
    left: auto;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

#btn-delivery-race.sigvsa-race-fab--grabbing {
    cursor: grabbing;
}

/* input file no perfil: escondido mas focável por programação (input.click() no botão) */
.profile-photo-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
}

/* Opt-in identidade no rodapé do modal “Ranking do dia” — interruptor */
.race-identity-toggle-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.45rem 0.75rem 0.4rem;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.race-identity-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1;
    text-align: left;
    padding-top: 0.06rem;
}

.race-identity-toggle-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.3;
    color: #334155;
    letter-spacing: 0.01em;
}

.race-identity-toggle-hint {
    display: block;
    font-size: 0.65rem;
    line-height: 1.25;
    color: #64748b;
}

/* Alinhado ao título (1.ª linha), não ao centro do bloco de 2 linhas */
.race-identity-switch-wrap {
    position: relative;
    display: inline-flex;
    width: 2.875rem;
    height: 1.75rem;
    flex-shrink: 0;
    align-items: center;
    align-self: flex-start;
    margin-top: 0.12rem;
}

.race-identity-switch-input {
    position: absolute;
    inset: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.race-identity-switch-input:focus-visible + .race-identity-track {
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.45);
}

.race-identity-track {
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
    transition: background 0.22s ease, box-shadow 0.15s ease;
}

.race-identity-switch-input:checked + .race-identity-track {
    background: linear-gradient(180deg, #34d399 0%, #059669 100%);
    box-shadow: inset 0 1px 2px rgba(6, 78, 59, 0.25);
}

.race-identity-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 9999px;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    box-shadow:
        0 1px 3px rgba(15, 23, 42, 0.18),
        0 1px 1px rgba(255, 255, 255, 0.9) inset;
    transition: transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.race-identity-switch-input:checked + .race-identity-track .race-identity-knob {
    transform: translateX(1.2rem);
}

.race-identity-switch-input:disabled + .race-identity-track {
    opacity: 0.55;
    pointer-events: none;
}

/* Ranking do dia: leve desfoque atrás do consentimento (antes era forte demais). */
.delivery-race-main-blurred {
    filter: blur(5px);
    opacity: 0.94;
    pointer-events: none;
    user-select: none;
}

.race-participate-btn-cta {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 42%, #0d9488 100%);
    box-shadow:
        0 6px 20px rgba(37, 99, 235, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.race-participate-btn-cta:active {
    box-shadow:
        0 4px 14px rgba(37, 99, 235, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.race-consent-yes-btn {
    background: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.race-consent-card {
    animation: race-consent-in 0.28s ease-out;
}

@keyframes race-consent-in {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Rodapé: chamar atenção discreta para “Participar” */
.race-participate-nudge {
    animation: race-participate-nudge 2s ease-in-out infinite;
}

@keyframes race-participate-nudge {
    0%,
    100% {
        transform: translateY(0);
    }
    35% {
        transform: translateY(-5px);
    }
    70% {
        transform: translateY(2px);
    }
}
