/* ============================================================
   cobrinha_campo.css — Cobrinha em Campo
   ============================================================ */

#ccampo-app {
    width: 100%;
    font-family: 'Fredoka', 'Inter', sans-serif;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
}

/* ── HUD SUPERIOR ────────────────────────────────────────── */
.ccampo-hud {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: rgba(0, 39, 118, 0.9);
    border-radius: 14px 14px 0 0;
    padding: 10px 20px;
    width: 100%;
}

.ccampo-badge {
    background: rgba(255,255,255,0.95);
    border-radius: 20px;
    padding: 5px 16px;
    font-size: 1rem;
    font-weight: 700;
    color: #002776;
}
.ccampo-badge b { font-weight: 900; }

/* ── CANVAS ────────────────────────────────────────────── */
#ccampo-container {
    position: relative;
    width: 100%;
    height: 420px;
    background: linear-gradient(180deg, #006632 0%, #009c3b 50%, #007a2e 100%);
    background-image: url('../img/tcopa_campo_bg.png');
    background-size: cover;
    background-position: center;
    border-left: 4px solid #ffdf00;
    border-right: 4px solid #ffdf00;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    overflow: hidden;
}

#ccampo-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none; /* Previne scroll no swipe */
}

/* Overlay de Início/Contagem */
#ccampo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 39, 118, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.ccampo-btn-start {
    background: #ffdf00;
    color: #002776;
    border: none;
    padding: 12px 24px;
    font-size: 1.5rem;
    font-weight: 900;
    font-family: 'Fredoka', sans-serif;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 0 #d4a900;
    text-transform: uppercase;
}
.ccampo-btn-start:active {
    transform: translateY(6px);
    box-shadow: 0 0px 0 #d4a900;
}
#ccampo-msg-centro {
    font-size: 4rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
    display: none;
}

/* ── PAINEL ALVO (RODAPÉ) ────────────────────────────────── */
.ccampo-alvo-area {
    background: #002776;
    border-radius: 0 0 14px 14px;
    width: 100%;
    padding: 15px;
    text-align: center;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
}
.ccampo-alvo-texto {
    font-size: 1.1rem;
    color: #ffdf00;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
}
#ccampo-alvo-nome {
    display: block;
    font-size: 2.2rem;
    color: white;
    font-weight: 900;
    letter-spacing: 1px;
}

/* Shake e Efeitos */
.ccampo-shake {
    animation: ccampoShakeAnim 0.3s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes ccampoShakeAnim {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.ccampo-flash-red {
    animation: ccampoFlashRed 0.4s ease-out;
}
@keyframes ccampoFlashRed {
    0% { box-shadow: inset 0 0 50px rgba(239, 68, 68, 0.8); }
    100% { box-shadow: inset 0 0 0 rgba(239, 68, 68, 0); }
}

.ccampo-flash-green {
    animation: ccampoFlashGreen 0.4s ease-out;
}
@keyframes ccampoFlashGreen {
    0% { box-shadow: inset 0 0 50px rgba(34, 197, 94, 0.8); }
    100% { box-shadow: inset 0 0 0 rgba(34, 197, 94, 0); }
}

/* ── CONTROLES MOBILE (D-PAD) ────────────────────────────── */
.ccampo-controles {
    display: none;
    margin-top: 20px;
    position: relative;
    width: 160px;
    height: 160px;
}
.ccampo-dpad-btn {
    position: absolute;
    width: 50px;
    height: 50px;
    background: #002776;
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.5rem;
    font-weight: 900;
    box-shadow: 0 5px 0 #001344;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
}
.ccampo-dpad-btn:active {
    transform: translateY(5px);
    box-shadow: 0 0 0 #001344;
}

.ccampo-btn-up { top: 0; left: 55px; }
.ccampo-btn-down { bottom: 0; left: 55px; }
.ccampo-btn-left { top: 55px; left: 0; }
.ccampo-btn-right { top: 55px; right: 0; }

@media (max-height: 800px) and (min-width: 501px) {
    #ccampo-container { height: 320px; }
}

@media (max-width: 768px) {
    #ccampo-container { height: 280px; }
    .ccampo-controles { display: block; margin-top: 10px; }
    .ccampo-alvo-area { border-radius: 0; padding: 10px; }
    #ccampo-alvo-nome { font-size: 1.6rem; }

    /* Shrink end screen items to fit within 280px height */
    .ccampo-nuvito-anim { width: 75px !important; margin-bottom: 5px !important; }
    #ccampo-res-titulo { font-size: 1.8rem; margin-bottom: 5px; }
    .ccampo-res-stats { margin-bottom: 10px; gap: 10px; }
    .ccampo-res-stat-box { padding: 10px 15px; }
    .ccampo-res-stat-box span { font-size: 1.5rem; }
    #ccampo-res-lista-bandeiras { max-height: 55px !important; margin-bottom: 10px !important; }
    .ccampo-btn-start { font-size: 1rem !important; padding: 10px 20px; }
}

/* ── TIMER E PROGRESSO ───────────────────────────────────── */
.ccampo-hud-relogio {
    background: #fff;
    color: #002776;
    padding: 6px 14px;
    border-radius: 12px;
    font-weight: 900;
    font-size: 1.1rem;
    box-shadow: 0 4px 0 #ccd6e0;
}
.ccampo-hud-relogio.acabando {
    color: #ef4444;
    animation: ccampoPiscarRelogio 0.8s infinite;
}
@keyframes ccampoPiscarRelogio {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); color: #dc2626; }
}

.ccampo-prog-wrap {
    flex-grow: 1;
    background: rgba(255,255,255,0.2);
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    margin: 0 10px;
}
.ccampo-prog-fill {
    height: 100%;
    background: #22c55e;
    width: 100%;
    transition: width 1s linear;
}
.ccampo-prog-fill.acabando { background: #ef4444; }

/* ── TELA RESULTADO ──────────────────────────────────────── */
#ccampo-resultado {
    position: absolute;
    inset: 0;
    background: rgba(0, 39, 118, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    text-align: center;
    border-radius: 14px;
    overflow-y: auto;
    padding: 10px 0;
}
/* Força a imagem a ficar num bom tamanho no desktop */
.ccampo-nuvito-anim { width: 100px !important; margin-bottom: 5px !important; }
#ccampo-res-titulo {
    color: #ffdf00;
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 5px;
}
.ccampo-res-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}
.ccampo-res-stat-box {
    background: rgba(255,255,255,0.1);
    padding: 10px 20px;
    border-radius: 12px;
    color: #fff;
}
.ccampo-res-stat-box span {
    display: block;
    font-size: 1.8rem;
    font-weight: 900;
    color: #ffdf00;
    line-height: 1;
    margin-bottom: 2px;
}
.ccampo-res-stat-box small {
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0.9;
}

/* Custom scrollbar para o histórico de bandeiras */
#ccampo-res-lista-bandeiras::-webkit-scrollbar { width: 6px; }
#ccampo-res-lista-bandeiras::-webkit-scrollbar-track { background: transparent; }
#ccampo-res-lista-bandeiras::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 10px; }

/* ── EFEITO DE PERIGO (10s finais) ───────────────────────── */
.ccampo-perigo {
    animation: ccampoPiscaPerigo 1s infinite alternate;
}
@keyframes ccampoPiscaPerigo {
    0% { box-shadow: inset 0 0 10px rgba(239, 68, 68, 0.2); }
    100% { box-shadow: inset 0 0 60px rgba(239, 68, 68, 0.9), 0 0 20px rgba(239, 68, 68, 0.5); border-color: #ef4444 !important; }
}

/* ── ANIMAÇÃO DO NUVITO ──────────────────────────────── */
.ccampo-nuvito-anim {
    animation: ccampoNuvitoFlutua 2.5s ease-in-out infinite;
}
@keyframes ccampoNuvitoFlutua {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(-4deg); }
    75% { transform: translateY(-8px) rotate(4deg); }
}
