:root {
    --primary: #166534;
    --secondary: #fbbf24;
}

body {
    background-color: #f0fdf4;
    background-image: linear-gradient(rgba(240, 253, 244, 0.88), rgba(240, 253, 244, 0.96)), url('assets/env/forest_background.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    font-family: 'Quicksand', sans-serif;
    color: #1f2937;
}

header, nav {
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.brand-font { font-family: 'Fredoka One', cursive; letter-spacing: 0.5px; }

@keyframes progress { from { width: 0; } to { width: 100%; } }
@keyframes bounce-subtle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5%); } }
@keyframes timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.animate-fadeIn { animation: fadeIn 0.4s ease-out forwards; }
.btn-bounce { transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.btn-bounce:active { transform: scale(0.92); }
.btn-bounce:hover { transform: scale(1.02); }

@keyframes shiny-anim {
    0% { box-shadow: 0 0 5px #fbbf24; }
    50% { box-shadow: 0 0 15px #fbbf24; }
    100% { box-shadow: 0 0 5px #fbbf24; }
}

.shiny-card { animation: shiny-anim 3s infinite; border: 2px solid #fbbf24; }

.mythic-card { animation: mythic-anim 4s infinite; border: 4px solid #a855f7; background: linear-gradient(135deg, #faf5ff, #ffffff); }
@keyframes mythic-anim {
    0% { box-shadow: 0 0 10px #a855f7; }
    50% { box-shadow: 0 0 25px #c084fc, inset 0 0 15px #e9d5ff; }
    100% { box-shadow: 0 0 10px #a855f7; }
}

#splashScreen {
    position: fixed; inset: 0;
    background-image: linear-gradient(rgba(22, 101, 52, 0.5), rgba(22, 101, 52, 0.85)), url('assets/env/forest_background.webp');
    background-size: cover;
    background-position: center;
    z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.5s;
}

#authScreen {
    background-image: linear-gradient(rgba(22, 101, 52, 0.55), rgba(22, 101, 52, 0.85)), url('assets/env/forest_background.webp');
    background-size: cover;
    background-position: center;
}

.parental-gate {
    position: fixed; inset: 0; background: rgba(22, 101, 52, 0.95);
    backdrop-filter: blur(8px); z-index: 9999; display: none;
    align-items: center; justify-content: center;
}

.tab-active { color: var(--primary); border-top: 3px solid var(--primary); padding-top: 11px; margin-top: -14px; }
.select-pill.active { background-color: var(--primary); color: white; border-color: var(--primary); }

.particle { position: fixed; pointer-events: none; z-index: 9999; animation: particle-anim 0.6s cubic-bezier(0, .9, .57, 1) forwards; }
@keyframes particle-anim {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0); opacity: 0; }
}

.capy-slot {
    position: absolute;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(-50%, -50%);
    transition: left 0.2s ease, top 0.2s ease, width 0.2s ease, height 0.2s ease, transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.slot-head { left: 50%; top: 14%; width: 40%; height: 30%; z-index: 20; }
.slot-eyes { left: 53%; top: 28.5%; width: 32%; height: 16%; z-index: 25; }
.slot-body { left: 50%; top: 64%; width: 44%; height: 36%; z-index: 15; }
.slot-hand { left: 25%; top: 65%; width: 24%; height: 26%; z-index: 30; }
.slot-feet { left: 51%; top: 87%; width: 36%; height: 22%; z-index: 14; }

.ad-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 9999; display: none; align-items: center; justify-content: center; }

/* Minigames Styles */
.silhouette {
    color: transparent;
    text-shadow: 0 0 0 #1e3a8a; /* Escuro para formar a silhueta */
    user-select: none;
    transition: all 0.5s ease;
}
.silhouette.revealed {
    color: initial;
    text-shadow: none;
    animation: bounce-in 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes bounce-in { 
    0% { transform: scale(0); } 
    50% { transform: scale(1.3); } 
    100% { transform: scale(1); } 
}

/* ==========================================================================
   ARCADE NATURAL — ESTILOS APRIMORADOS DOS 4 MINIGAMES
   ========================================================================== */
.arcade-tab {
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.4rem 0.75rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
}
.arcade-tab:hover {
    background: rgba(255, 255, 255, 0.3);
}
.arcade-tab.active {
    background: #ffffff;
    color: #1e3a8a;
    border-color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
}

.arcade-silhouette-stage {
    background: radial-gradient(circle at 50% 42%, #eff6ff 0%, #dbeafe 55%, #bfdbfe 100%);
    transition: background 0.45s ease, box-shadow 0.45s ease;
}
.arcade-silhouette-stage.is-revealed {
    background: radial-gradient(circle at 50% 42%, #fef9c3 0%, #dcfce7 55%, #bbf7d0 100%);
    box-shadow: inset 0 0 28px rgba(34, 197, 94, 0.25);
}

@keyframes arcadeShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
.arcade-shake {
    animation: arcadeShake 0.36s ease-in-out;
}

@keyframes arcadePop {
    0% { transform: scale(0.88); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
.arcade-pop {
    animation: arcadePop 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Jogo da Memória — Cartas 3D naturais */
.memory-card {
    perspective: 1000px;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    min-height: 60px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.memory-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    transform-style: preserve-3d;
}
.memory-card.flipped .memory-card-inner {
    transform: rotateY(180deg);
}
.memory-front, .memory-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    box-shadow: 0 4px 10px -2px rgba(88, 28, 135, 0.18);
}
.memory-front {
    background: linear-gradient(135deg, #9333ea 0%, #c084fc 100%);
    border: 2px solid rgba(255, 255, 255, 0.35);
    transform: rotateY(0deg);
    font-size: 1.4rem;
    color: #fff;
}
.memory-card:hover:not(.flipped):not(.memory-matched) .memory-front {
    filter: brightness(1.06);
    transform: translateY(-2px);
}
.memory-back {
    background: linear-gradient(180deg, #ffffff 0%, #faf5ff 100%);
    transform: rotateY(180deg);
    font-size: 2rem;
    border: 2px solid #a855f7;
}
.memory-matched .memory-back {
    background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #22c55e;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.35);
}
.memory-matched {
    opacity: 0.72;
    pointer-events: none;
    transform: scale(0.93);
    transition: all 0.35s ease;
}

/* Cards mais bonitos */
.animal-card {
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
    border: 1px solid rgba(22, 101, 52, 0.1);
    box-shadow: 0 10px 25px -5px rgba(22, 101, 52, 0.05);
}

/* Modo Noturno (Night Mode) */
body.night-mode {
    background-color: #0f172a;
    background-image: linear-gradient(rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.96)), url('assets/env/forest_background.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #cbd5e1;
}
body.night-mode header, body.night-mode nav {
    background: rgba(15, 23, 42, 0.85) !important;
}
body.night-mode .animal-card {
    background: linear-gradient(to bottom, #1e293b, #0f172a);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
body.night-mode .bg-white { background-color: #1e293b; color: #f8fafc; }
body.night-mode .text-green-900 { color: #34d399; }
body.night-mode .text-gray-600 { color: #94a3b8; }
body.night-mode .bg-green-50 { background-color: #0f172a; border-color: #334155; }
body.night-mode .text-amber-900 { color: #fbbf24; }
body.night-mode .bg-blue-50, body.night-mode .bg-amber-50, body.night-mode .bg-purple-50 { background-color: #0f172a; border-color: #334155; }
body.night-mode .bg-white\/90 { background-color: rgba(30, 41, 59, 0.9) !important; color: #f8fafc !important; }
body.night-mode .bg-white\/95 { background-color: rgba(30, 41, 59, 0.95) !important; color: #f8fafc !important; }
body.night-mode .bg-green-50\/70 { background-color: rgba(15, 23, 42, 0.7) !important; border-color: #334155 !important; }
body.night-mode .bg-gray-50 { background-color: #0f172a !important; color: #f8fafc !important; border-color: #334155 !important; }
body.night-mode input[type="text"],
body.night-mode input[type="number"] {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}
body.night-mode input::placeholder {
    color: #64748b !important;
}
body.night-mode .text-on-white {
    color: #0f172a !important;
}

/* Álbum de Figurinhas */
.sticker {
    transition: all 0.3s ease;
    filter: grayscale(100%) opacity(0.3) brightness(0);
    transform: scale(0.9);
}
.sticker.collected {
    filter: none;
    transform: scale(1);
    animation: bounce-in 0.5s ease;
}

/* Caixa Surpresa */
@keyframes shake {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(10deg); }
    50% { transform: rotate(-10deg); }
    75% { transform: rotate(5deg); }
    100% { transform: rotate(0deg); }
}
.box-shake { animation: shake 0.4s infinite; }

/* Estilos Especiais da Eco-Vila */
#vilaView {
    animation: fadeIn 0.4s ease-out forwards;
}

/* =====================================================
   MENU PRINCIPAL — ESTILOS PREMIUM
   ===================================================== */
#mainMenuScreen {
    animation: menuFadeIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes menuFadeIn {
    from { opacity: 0; transform: scale(1.03); }
    to   { opacity: 1; transform: scale(1); }
}

.menu-glass-pill {
    background: rgba(12, 30, 18, 0.62);
    border: 1px solid rgba(251, 191, 36, 0.32);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32);
}

.menu-title-plaque {
    background: linear-gradient(155deg, rgba(92, 54, 16, 0.92) 0%, rgba(124, 74, 22, 0.94) 50%, rgba(78, 45, 12, 0.94) 100%);
    border: 3px solid rgba(251, 191, 36, 0.55);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(254, 240, 138, 0.35);
}

.menu-logo-badge {
    animation: menuFloat 4.2s ease-in-out infinite;
}
@keyframes menuFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Botão Herói: JOGAR ECO-VILA */
.menu-cta-play {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 52%, #0f766e 100%);
    border: 2px solid rgba(253, 224, 71, 0.72);
    box-shadow: 0 6px 0 #14532d, 0 14px 26px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.menu-cta-play::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.22) 50%, transparent 70%);
    transform: translateX(-120%);
    animation: menuShimmer 3.6s ease-in-out infinite;
    pointer-events: none;
}
@keyframes menuShimmer {
    0%, 60% { transform: translateX(-120%); }
    100% { transform: translateX(130%); }
}
.menu-cta-play:hover {
    transform: translateY(-2px);
    filter: brightness(1.07);
    box-shadow: 0 8px 0 #14532d, 0 18px 30px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.menu-cta-play:active {
    transform: translateY(3px) scale(0.98) !important;
    box-shadow: 0 2px 0 #14532d, 0 6px 12px rgba(0, 0, 0, 0.38);
}

/* Cards de Modo (Grid 2x2) */
.menu-tile-btn {
    background: linear-gradient(160deg, rgba(17, 42, 26, 0.84) 0%, rgba(12, 29, 20, 0.9) 100%);
    border: 1.5px solid rgba(251, 191, 36, 0.34);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 0 rgba(6, 20, 12, 0.85), 0 10px 18px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.menu-tile-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(253, 224, 71, 0.72);
    background: linear-gradient(160deg, rgba(22, 56, 34, 0.9) 0%, rgba(14, 38, 25, 0.94) 100%);
}

/* Botões secundários (Conquistas / Continuar) */
.menu-secondary-btn {
    background: rgba(15, 32, 22, 0.74);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
}
.menu-secondary-btn:hover {
    border-color: rgba(251, 191, 36, 0.55);
    background: rgba(24, 52, 34, 0.85);
    transform: translateY(-1px);
}

/* Vagalumes suaves no fundo do menu */
.menu-firefly {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 9999px;
    background: radial-gradient(circle, #fef08a 0%, rgba(250, 204, 21, 0.4) 55%, transparent 100%);
    box-shadow: 0 0 12px 3px rgba(254, 240, 138, 0.65);
    animation: menuFireflyFloat 5.5s ease-in-out infinite;
    opacity: 0.75;
}
@keyframes menuFireflyFloat {
    0%, 100% { transform: translate(0, 0) scale(0.8); opacity: 0.25; }
    50% { transform: translate(12px, -18px) scale(1.25); opacity: 0.95; }
}

@media (prefers-reduced-motion: reduce) {
    .menu-logo-badge,
    .menu-cta-play::after,
    .menu-firefly {
        animation: none !important;
    }
}

.social-btn {
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.2s;
}
.social-btn:hover { filter: brightness(1.15); }

/* =====================================================
   DESIGN SYSTEM GLOBAL — FLORESTA DOURADA (GLASS TROPICAL)
   ===================================================== */
.capy-header-glass {
    background: linear-gradient(180deg, rgba(12, 34, 21, 0.94) 0%, rgba(18, 48, 30, 0.9) 100%) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1.5px solid rgba(251, 191, 36, 0.4);
    box-shadow: 0 8px 24px rgba(6, 20, 12, 0.28);
}

.capy-header-pill {
    background: rgba(8, 24, 15, 0.55);
    border: 1px solid rgba(251, 191, 36, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.capy-bottom-dock {
    background: linear-gradient(180deg, rgba(14, 38, 24, 0.95) 0%, rgba(9, 25, 16, 0.98) 100%) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1.5px solid rgba(251, 191, 36, 0.4);
    box-shadow: 0 -8px 26px rgba(6, 20, 12, 0.35);
}

.capy-bottom-dock button {
    color: rgba(226, 232, 240, 0.62);
    transition: color 0.2s ease, transform 0.15s ease;
}
.capy-bottom-dock button:hover {
    color: #fde68a;
}
.capy-bottom-dock button.tab-active {
    color: #fde047 !important;
}
.capy-bottom-dock button.tab-active::after {
    background: linear-gradient(90deg, #fbbf24, #34d399) !important;
    height: 3px;
    border-radius: 9999px;
}

.capy-capture-fab {
    background: linear-gradient(135deg, #22c55e 0%, #15803d 55%, #0f766e 100%);
    border: 3px solid rgba(253, 224, 71, 0.85);
    box-shadow: 0 5px 0 #14532d, 0 12px 24px rgba(0, 0, 0, 0.45), 0 0 18px rgba(52, 211, 153, 0.45);
    color: #ffffff !important;
}
.capy-capture-fab:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
}
.capy-capture-fab:active {
    transform: translateY(2px) scale(0.95);
    box-shadow: 0 2px 0 #14532d, 0 6px 14px rgba(0, 0, 0, 0.4);
}

.capy-hero-banner {
    border: 2px solid rgba(251, 191, 36, 0.45);
    box-shadow: 0 14px 28px rgba(6, 24, 14, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.capy-surface-card {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid rgba(251, 191, 36, 0.28) !important;
    box-shadow: 0 10px 24px rgba(15, 38, 22, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.85) !important;
}

.capy-supervisor-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.94) 0%, rgba(240, 253, 244, 0.92) 100%) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid rgba(251, 191, 36, 0.35) !important;
    box-shadow: 0 8px 20px rgba(15, 38, 22, 0.08) !important;
}

.capy-modal-surface {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 254, 249, 0.98) 100%) !important;
    border: 2px solid rgba(251, 191, 36, 0.45);
    box-shadow: 0 24px 48px rgba(6, 20, 12, 0.45);
}

body.night-mode .capy-surface-card,
body.night-mode .capy-supervisor-card {
    background: rgba(15, 32, 24, 0.86) !important;
    border-color: rgba(251, 191, 36, 0.25) !important;
    color: #f1f5f9 !important;
}
body.night-mode .capy-modal-surface {
    background: linear-gradient(180deg, rgba(15, 32, 24, 0.97) 0%, rgba(10, 22, 16, 0.98) 100%) !important;
    border-color: rgba(251, 191, 36, 0.35);
    color: #f1f5f9;
}

/* Character Library */
.char-tab-btn {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 9999px;
    font-weight: 800;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid transparent;
    color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.1);
    transition: all 0.25s ease;
    cursor: pointer;
}
.char-tab-btn.active {
    background: #FFE066;
    color: #14532d;
    border-color: #d97706;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Sprite canvas para o personagem na biblioteca */
.char-lib-sprite-canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Ficha técnica do personagem */
.char-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.building-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.building-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -8px rgba(22, 101, 52, 0.12);
}

/* Ajustes finos para a navegação inferior com 7 itens */
@media (max-width: 480px) {
    nav.fixed {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    nav.fixed button {
        font-size: 8px !important;
    }
    nav.fixed button i {
        font-size: 15px !important;
    }
    nav.fixed button span {
        font-size: 7px !important;
        letter-spacing: -0.3px !important;
    }
}

/* Animação de realce do card ao clicar no prédio do mapa */
.highlight-card {
    animation: cardFlash 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardFlash {
    0%, 100% {
        border-color: #f1f5f9;
        transform: scale(1);
    }
    30% {
        border-color: #d97706;
        box-shadow: 0 0 0 6px rgba(217, 119, 6, 0.3), 0 20px 25px -5px rgba(217, 119, 6, 0.1);
        transform: scale(1.03);
    }
    60% {
        border-color: #d97706;
        box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.2);
        transform: scale(1.01);
    }
}

/* Efeitos de Animação Ambiental da Vila */

/* 1. Nuvens em movimento no céu */
.village-cloud {
    position: absolute;
    opacity: 0.45;
    pointer-events: none;
    z-index: 5;
    animation: moveClouds linear infinite;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.05));
}
.cloud-1 {
    width: 25%;
    top: 2%;
    animation-duration: 55s;
}
.cloud-2 {
    width: 35%;
    top: 6%;
    animation-duration: 90s;
    animation-delay: -25s;
}
.cloud-3 {
    width: 20%;
    top: 4%;
    animation-duration: 70s;
    animation-delay: -45s;
}
@keyframes moveClouds {
    0% { transform: translateX(-150%); }
    100% { transform: translateX(450%); }
}

/* 2. Névoa na base da cachoeira */
.waterfall-mist {
    position: absolute;
    width: 35px;
    height: 35px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
    z-index: 5;
    border-radius: 50%;
    animation: waterfallSplash 2.5s infinite ease-out;
}
.mist-1 {
    left: 85%;
    top: 38%;
    animation-delay: 0s;
}
.mist-2 {
    left: 84%;
    top: 39%;
    animation-delay: 0.8s;
}
.mist-3 {
    left: 86%;
    top: 37%;
    animation-delay: 1.6s;
}
@keyframes waterfallSplash {
    0% { transform: scale(0.6) translateY(5px); opacity: 0; }
    40% { opacity: 0.8; }
    100% { transform: scale(1.8) translateY(-10px); opacity: 0; }
}

/* 3. Correnteza do Rio */
.river-current {
    position: absolute;
    width: 45px;
    height: 3px;
    background: rgba(224, 242, 254, 0.8);
    pointer-events: none;
    z-index: 5;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
    animation-duration: 2.2s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}
.current-1 {
    left: 74%;
    top: 46%;
    animation-name: flowRiver1;
    animation-delay: 0s;
}
.current-2 {
    left: 70%;
    top: 56%;
    animation-name: flowRiver1;
    animation-delay: 1.1s;
}
.current-3 {
    left: 60%;
    top: 66%;
    animation-name: flowRiver2;
    animation-delay: 0.4s;
}
.current-4 {
    left: 52%;
    top: 75%;
    animation-name: flowRiver3;
    animation-delay: 1.5s;
}
.current-5 {
    left: 38%;
    top: 82%;
    animation-name: flowRiver4;
    animation-delay: 0.8s;
}
.current-6 {
    left: 24%;
    top: 92%;
    animation-name: flowRiver5;
    animation-delay: 1.9s;
}
@keyframes flowRiver1 {
    0% { transform: translate(0, 0) scaleX(0.7) rotate(-40deg); opacity: 0; }
    50% { opacity: 0.85; }
    100% { transform: translate(-35px, 29px) scaleX(1.3) rotate(-40deg); opacity: 0; }
}
@keyframes flowRiver2 {
    0% { transform: translate(0, 0) scaleX(0.7) rotate(-30deg); opacity: 0; }
    50% { opacity: 0.85; }
    100% { transform: translate(-45px, 26px) scaleX(1.3) rotate(-30deg); opacity: 0; }
}
@keyframes flowRiver3 {
    0% { transform: translate(0, 0) scaleX(0.7) rotate(-25deg); opacity: 0; }
    50% { opacity: 0.85; }
    100% { transform: translate(-48px, 22px) scaleX(1.3) rotate(-25deg); opacity: 0; }
}
@keyframes flowRiver4 {
    0% { transform: translate(0, 0) scaleX(0.7) rotate(-15deg); opacity: 0; }
    50% { opacity: 0.85; }
    100% { transform: translate(-52px, 14px) scaleX(1.3) rotate(-15deg); opacity: 0; }
}
@keyframes flowRiver5 {
    0% { transform: translate(0, 0) scaleX(0.7) rotate(-12deg); opacity: 0; }
    50% { opacity: 0.85; }
    100% { transform: translate(-55px, 12px) scaleX(1.3) rotate(-12deg); opacity: 0; }
}

/* 4. Folhas ao vento */
.wind-leaf {
    position: absolute;
    font-size: 10px;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    animation: windFlutter 8s infinite linear;
}
.leaf-1 { left: 10%; top: -5%; animation-delay: 0s; }
.leaf-2 { left: 45%; top: -5%; animation-delay: 2s; }
.leaf-3 { left: 75%; top: -5%; animation-delay: 4s; }
.leaf-4 { left: 30%; top: -5%; animation-delay: 6s; }
@keyframes windFlutter {
    0% { transform: translate(0, 0) rotate(0deg) scale(0.8); opacity: 0; }
    10% { opacity: 0.75; }
    90% { opacity: 0.75; }
    100% { transform: translate(220px, 480px) rotate(480deg) scale(0.6); opacity: 0; }
}

/* 5. Borboletas flutuantes (perto da horta/flores) */
.village-butterfly {
    position: absolute;
    font-size: 11px;
    pointer-events: none;
    z-index: 10;
    opacity: 0.85;
    animation: butterflyFlutter 6s infinite ease-in-out;
}
.bf-1 { left: 22%; top: 46%; animation-delay: 0s; }
.bf-2 { left: 16%; top: 52%; animation-delay: 1.5s; animation-duration: 7s; }
.bf-3 { left: 28%; top: 50%; animation-delay: 3s; animation-duration: 5s; }

@keyframes butterflyFlutter {
    0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
    25% { transform: translate(12px, -15px) scale(0.9) rotate(20deg); }
    50% { transform: translate(6px, -28px) scale(1.1) rotate(-15deg); }
    75% { transform: translate(-8px, -12px) scale(0.85) rotate(10deg); }
}

/* 6. Peixes pulando no rio (perto das docas) */
.jumping-fish {
    position: absolute;
    font-size: 12px;
    pointer-events: none;
    z-index: 9;
    opacity: 0;
    animation: fishJump 8s infinite ease-in-out;
}
.fish-1 { left: 74%; top: 62%; animation-delay: 0s; }
.fish-2 { left: 64%; top: 72%; animation-delay: 3.5s; animation-duration: 9s; }

@keyframes fishJump {
    0%, 90%, 100% { transform: translate(0, 0) scale(0) rotate(-45deg); opacity: 0; }
    92% { transform: translate(-8px, -16px) scale(1) rotate(-20deg); opacity: 1; }
    94% { transform: translate(-16px, -22px) scale(1) rotate(10deg); opacity: 1; }
    96% { transform: translate(-24px, -10px) scale(0.8) rotate(45deg); opacity: 0.8; }
    98%, 100% { transform: translate(-30px, 0) scale(0) rotate(90deg); opacity: 0; }
}

/* 7. Vaga-lumes brilhando (perto do Lab/mata) */
.village-firefly {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fef08a;
    border-radius: 50%;
    box-shadow: 0 0 8px #facc15, 0 0 16px #fbbf24;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    animation: fireflyFloat 5s infinite ease-in-out;
}
.ffy-1 { left: 66%; top: 32%; animation-delay: 0s; }
.ffy-2 { left: 72%; top: 28%; animation-delay: 1.2s; }
.ffy-3 { left: 12%; top: 40%; animation-delay: 2.5s; }
.ffy-4 { left: 88%; top: 22%; animation-delay: 3.7s; }

@keyframes fireflyFloat {
    0%, 100% { transform: translate(0, 0); opacity: 0; }
    30% { opacity: 0.9; }
    70% { opacity: 0.8; transform: translate(12px, -20px); }
    90% { opacity: 0; }
}

/* 8. Fumaça subindo das chaminés (Prefeitura e Docas) */
.chimney-smoke {
    position: absolute;
    font-size: 8px;
    color: rgba(240, 240, 240, 0.6);
    pointer-events: none;
    z-index: 11;
    opacity: 0;
    animation: smokeRise 4s infinite ease-out;
}
.smoke-th1 { left: 47.5%; top: 15%; animation-delay: 0s; }
.smoke-th2 { left: 47.5%; top: 15%; animation-delay: 2s; }
.smoke-dk1 { left: 75.5%; top: 42%; animation-delay: 0.5s; }
.smoke-dk2 { left: 75.5%; top: 42%; animation-delay: 2.5s; }

@keyframes smokeRise {
    0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
    15% { opacity: 0.5; }
    100% { transform: translate(-15px, -35px) scale(2.2); opacity: 0; filter: blur(1px); }
}

/* ==========================================================================
   SISTEMA DE ALINHAMENTO ANATÔMICO DOS ACESSÓRIOS DO MASCOTE (CALIBRADO EM %)
   ========================================================================== */
@keyframes accPopIn {
    0% { opacity: 0; transform: scale(0.72); }
    100% { opacity: 1; transform: scale(1); }
}

.capy-slot img.acc-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.22));
    animation: accPopIn 0.24s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ==========================================================================
   SISTEMA DE NPCs DE CAPIVARAS PASSEADORAS (NATIVE NPCs)
   ========================================================================== */

.village-npc {
    position: absolute;
    width: 32px;
    height: 32px;
    transform: translate(-50%, -50%) scale(1.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    pointer-events: auto;
    cursor: pointer;
    transition: left 0.3s linear, top 0.3s linear, transform 0.2s ease;
    z-index: 15;
}

.village-npc:hover {
    transform: translate(-50%, -50%) scale(1.5);
}

.npc-sprite-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.npc-sprite {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Custom spritesheet styles for original and custom capybaras are now dynamically injected by app.js */

/* Tag de nome flutuante ao pairar o mouse */
.npc-nametag {
    position: absolute;
    top: -12px;
    background: rgba(45, 34, 25, 0.9);
    color: #fde68a;
    font-size: 6px;
    font-weight: 900;
    font-family: system-ui, -apple-system, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 4px;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    border: 0.5px solid rgba(245, 158, 11, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 30;
}

/* Mostra tag de nome no hover */
.village-npc:hover .npc-nametag {
    opacity: 1;
}

/* Balão de fala dos NPCs */
.npc-bubble {
    position: absolute;
    bottom: calc(100% + 4px);
    background: #ffffff;
    color: #1b2e22;
    font-size: 7px;
    font-weight: 800;
    font-family: system-ui, -apple-system, sans-serif;
    padding: 3px 6px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    border: 1px solid #bbf7d0;
    pointer-events: none;
    z-index: 35;
    opacity: 0;
    transform: scale(0.8) translateY(5px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.npc-bubble.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.npc-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 3px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
}


/* Animação de Caminhada (Balanço lateral e pulo de passos) */
.npc-walk-anim {
    animation: capyWalkBounce 0.5s infinite ease-in-out;
}

@keyframes capyWalkBounce {
    0% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-2px) rotate(3deg); }
    100% { transform: translateY(0) rotate(-3deg); }
}

/* Animação de Descanso (Respiração) */
.npc-idle-anim {
    animation: capyIdleBreath 2s infinite ease-in-out;
}

@keyframes capyIdleBreath {
    0% { transform: scale(1) translateY(0); }
    50% { transform: scale(1, 0.95) translateY(0.5px); }
    100% { transform: scale(1) translateY(0); }
}

/* Animação de Trabalho/Interação (Pulos alegres rápidos) */
.npc-work-anim {
    animation: capyWorkJump 0.7s infinite ease-out;
}

@keyframes capyWorkJump {
    0% { transform: translateY(0) scaleY(1); }
    30% { transform: translateY(-4px) scaleY(1.06); }
    50% { transform: translateY(0) scaleY(0.94); }
    100% { transform: translateY(0) scaleY(1); }
}

/* Fullscreen mode for the Village Map Container */
#villageMapContainer.map-fullscreen {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: min(100vw, 56.25vh) !important; /* Preserves 9:16 aspect ratio on desktops */
    height: min(177.78vw, 100vh) !important;
    max-height: 100vh !important;
    max-width: 100vw !important;
    aspect-ratio: 9/16 !important;
    z-index: 9999 !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.85) !important;
}

@media (max-width: 768px) {
    #villageMapContainer.map-fullscreen {
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        max-width: 100vw !important;
        aspect-ratio: auto !important;
    }
}

/* Blurred dark backdrop for the fullscreen map */
#villageMapContainer.map-fullscreen::before {
    content: "";
    position: fixed;
    top: -100vh;
    left: -100vw;
    width: 300vw;
    height: 300vh;
    z-index: -1;
    pointer-events: none;
}

/* ── Arena: grama pixel art ──────────────────────── */
.wac-timer-bar {
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(to right, #22c55e, #4ade80);
    transition: width 0.28s linear, background 0.5s;
    box-shadow: 0 0 8px rgba(74,222,128,0.4);
}
.wac-timer-bar.warning {
    background: linear-gradient(to right, #f59e0b, #fbbf24);
    box-shadow: 0 0 8px rgba(251,191,36,0.45);
}
.wac-timer-bar.danger {
    background: linear-gradient(to right, #ef4444, #f87171);
    box-shadow: 0 0 10px rgba(239,68,68,0.6);
}

/* ── Pill de nível ───────────────────────────────── */
.wac-level-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #22c55e, #15803d);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 3px 10px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(21,128,61,0.45);
}


/* ── Arena: grama pixel art ──────────────────────── */
.wac-arena {
    background-image: url('assets/env/wac_grass_bg.webp');
    background-size: cover;
    background-position: center;
    border-radius: 1.5rem;
    padding: 1rem 0.5rem 1.5rem;
    box-shadow:
        inset 0 0 0 3px rgba(255,255,255,0.08),
        0 4px 20px rgba(0,0,0,0.4),
        inset 0 -4px 12px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    margin-bottom: 0.75rem;
    image-rendering: pixelated;
}
/* Vinheta nas bordas */
.wac-arena::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0,0,0,0.45) 100%);
    pointer-events: none;
    z-index: 0;
}

/* ── Grids ───────────────────────────────────────── */
.wac-grid { display: grid; gap: 18px 12px; justify-items: center; align-items: end; position: relative; z-index: 1; }
.wac-grid-c2 { grid-template-columns: repeat(2, 1fr); }
.wac-grid-c3 { grid-template-columns: repeat(3, 1fr); }
.wac-grid-c4 { grid-template-columns: repeat(4, 1fr); gap: 12px 8px; }

/* ── Toca individual ─────────────────────────────── */
.wac-hole {
    position: relative;
    width: 96px;
    height: 96px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
    /* Pequena sombra no chão */
    filter: drop-shadow(0 6px 8px rgba(0,0,0,0.45));
    /* Adicionando imagem da toca como fundo principal */
    background-image: url('assets/ui/wac_hole.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center bottom;
}
.wac-grid-c4 .wac-hole {
    width: 70px;
    height: 70px;
}

/* Camadas de fundo (agora invisíveis — substituídas pela imagem) */
.wac-mound-back,
.wac-mound-grass,
.wac-pit { display: none; }

/* ── Overlay da imagem da toca (z alto, cobre o corpo do sprite) ── */
.wac-mound-front {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 45px; /* altura até o labio frontal do buraco */
    background-image: url('assets/ui/wac_hole.png');
    background-size: 96px 96px; /* explicit background sizing to match the container */
    background-repeat: no-repeat;
    background-position: center bottom;
    z-index: 9;
    pointer-events: none;
    image-rendering: pixelated;
    overflow: hidden;
}
.wac-grid-c4 .wac-mound-front {
    height: 33px; /* altura escalada do labio frontal */
    background-size: 70px 70px; /* explicit scaled size */
}

/* ── Janela de recorte: sprite sobe aqui ─────────── */
.wac-peek-window {
    position: absolute;
    bottom: 30px;       /* altura do buraco na imagem */
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 80px;       /* increased height to prevent head clipping */
    overflow: hidden;
    z-index: 5;
    pointer-events: none;
}
.wac-grid-c4 .wac-peek-window {
    bottom: 22px;
    transform: translateX(-50%) scale(0.73);
    transform-origin: bottom center;
}

/* Sprite dentro da janela — sobe ao receber .up */
.wac-sprite-inner {
    position: absolute;
    bottom: -110px;
    left: 50%;
    transform: translateX(-50%);
    image-rendering: pixelated;
    transition: bottom 0.13s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: bottom;
}
.wac-hole.up .wac-sprite-inner {
    bottom: -5px;   /* raised from -20px to make the head and shoulders clearly visible */
}

/* ── Animação de acerto ──────────────────────────── */
@keyframes wacHitBurst {
    0%   { opacity: 1; transform: translateX(-50%) scale(1);    filter: brightness(2) saturate(2); }
    35%  { opacity: 1; transform: translateX(-50%) scale(1.6);  filter: brightness(4) saturate(3) hue-rotate(30deg); }
    100% { opacity: 0; transform: translateX(-50%) scale(0.1);  filter: brightness(1); }
}
.wac-hole.hit .wac-sprite-inner {
    animation: wacHitBurst 0.32s ease-out forwards;
    transition: none;
}

/* ── Shake na toca quando bate ───────────────────── */
@keyframes wacHoleShake {
    0%,100% { transform: translateX(0) rotate(0); }
    20%     { transform: translateX(-4px) rotate(-3deg); }
    40%     { transform: translateX(4px)  rotate(3deg); }
    60%     { transform: translateX(-3px) rotate(-2deg); }
    80%     { transform: translateX(3px)  rotate(2deg); }
}
.wac-hole.hit {
    animation: wacHoleShake 0.32s ease-out;
}

/* ── Estrelas de acerto ──────────────────────────── */
@keyframes wacStar {
    0%   { opacity: 1; transform: translate(0, 0) scale(1.3); }
    100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0); }
}
.wac-star {
    position: absolute;
    pointer-events: none;
    z-index: 30;
    font-size: 1.1rem;
    line-height: 1;
    animation: wacStar 0.55s ease-out forwards;
}

/* ── Pontuação flutuante ─────────────────────────── */
@keyframes wacScorePop {
    0%   { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1.5); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-50px) scale(1.0); }
}
.wac-score-pop {
    position: absolute;
    top: 0;
    left: 50%;
    font-size: 1rem;
    font-weight: 900;
    color: #fde047;
    text-shadow: 0 2px 6px rgba(0,0,0,0.8), 0 0 12px rgba(253,224,71,0.6);
    pointer-events: none;
    z-index: 30;
    animation: wacScorePop 0.7s ease-out forwards;
}

/* ── Erro (miss) ─────────────────────────────────── */
@keyframes wacMissRipple {
    0%   { filter: drop-shadow(0 0 0px rgba(239,68,68,0)); }
    40%  { filter: drop-shadow(0 0 12px rgba(239,68,68,0.9)); }
    100% { filter: drop-shadow(0 6px 8px rgba(0,0,0,0.45)); }
}
.wac-hole.miss {
    animation: wacMissRipple 0.42s ease-out;
}

/* ── Barra de tempo ──────────────────────────────── */
.wac-timer-bar {
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(to right, #22c55e, #4ade80);
    transition: width 0.28s linear, background 0.5s;
    box-shadow: 0 0 8px rgba(74,222,128,0.4);
}
.wac-timer-bar.warning {
    background: linear-gradient(to right, #f59e0b, #fbbf24);
    box-shadow: 0 0 8px rgba(251,191,36,0.45);
}
.wac-timer-bar.danger {
    background: linear-gradient(to right, #ef4444, #f87171);
    box-shadow: 0 0 10px rgba(239,68,68,0.6);
}

/* ── Pill de nível ───────────────────────────────── */
.wac-level-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #22c55e, #15803d);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 3px 10px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(21,128,61,0.45);
}

/* ==========================================================================
   SISTEMA DE MISSÕES E MINIJOGOS DA ECO-VILA
   ========================================================================== */

/* Alerta visual de Missão no NPC */
.npc-mission-alert {
    position: absolute;
    bottom: calc(100% + 4px);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    font-size: 10px;
    font-weight: 900;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.8), 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 1px solid #fef3c7;
    z-index: 30;
    pointer-events: none;
    animation: missionPulse 0.8s infinite alternate;
}

@keyframes missionPulse {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 4px rgba(245, 158, 11, 0.6);
    }
    100% {
        transform: scale(1.25);
        box-shadow: 0 0 16px rgba(245, 158, 11, 0.95);
    }
}

/* Minijogo 1: Horta */
.mg-horta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
}
.mg-soil-patch {
    aspect-ratio: 1;
    background: #855845;
    border: 3px solid #6b4436;
    border-radius: 1.25rem;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.4), 0 4px 6px rgba(0,0,0,0.1);
    -webkit-tap-highlight-color: transparent;
}
.mg-soil-patch::before {
    content: '';
    position: absolute;
    inset: 4px;
    background: rgba(0,0,0,0.1);
    border-radius: 0.8rem;
}
.mg-vegetable {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    object-fit: contain;
    transition: bottom 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    user-select: none;
}
.mg-vegetable.up {
    bottom: 8px;
}

/* Minijogo 2: Pesca */
.mg-fishing-container {
    width: 100%;
    max-width: 280px;
    text-align: center;
    margin: 0 auto;
    position: relative;
}
.mg-water-view {
    width: 100%;
    height: 110px;
    background: linear-gradient(180deg, #38bdf8, #0284c7);
    border-radius: 1.5rem;
    position: relative;
    overflow: hidden;
    border: 3px solid #0369a1;
    box-shadow: inset 0 4px 12px rgba(0,0,0,0.25);
}
.mg-fish-shadow {
    position: absolute;
    bottom: 8px;
    left: -60px;
    animation: fishSwim 2.5s infinite linear;
    transform: scaleX(-1);
    user-select: none;
    pointer-events: none;
    width: 60px;
    height: 60px;
    object-fit: contain;
}
.mg-bobber {
    position: absolute;
    top: 35px;
    left: 50%;
    transform: translateX(-50%);
    transition: top 0.1s ease;
    user-select: none;
    pointer-events: none;
    width: 55px;
    height: 55px;
    object-fit: contain;
}
.mg-bobber.dip {
    top: 55px;
    animation: bobberSplash 0.15s infinite alternate;
}
.mg-success-spark {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    pointer-events: none;
    z-index: 20;
    animation: sparkPop 0.5s ease-out forwards;
}
@keyframes sparkPop {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}
.mg-bar-container {
    width: 100%;
    height: 20px;
    background: #e2e8f0;
    border: 3px solid #94a3b8;
    border-radius: 10px;
    position: relative;
    margin-top: 15px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
.mg-sweet-spot {
    position: absolute;
    height: 100%;
    background: #22c55e;
    border-left: 2px solid #15803d;
    border-right: 2px solid #15803d;
}
.mg-needle {
    position: absolute;
    width: 6px;
    height: 100%;
    background: #ef4444;
    border-radius: 3px;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.8);
    top: 0;
    left: 0;
    transition: left 0.05s linear;
}
@keyframes fishSwim {
    0% { left: -60px; }
    100% { left: 105%; }
}
@keyframes bobberSplash {
    0% { transform: translateX(-50%) translateY(0); }
    100% { transform: translateX(-50%) translateY(-3px); }
}

/* Minijogo 3: Lab */
.mg-lab-container {
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}
.mg-potion-target {
    width: 85px;
    height: 85px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}
.mg-potion-flask-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 10;
    pointer-events: none;
}
.mg-potion-liquid {
    position: absolute;
    bottom: 6px;
    left: 10%;
    right: 10%;
    height: 48%;
    border-radius: 50% 50% 30% 30%;
    background-color: #cbd5e1;
    transition: background-color 0.3s ease;
    z-index: 5;
    animation: liquidBubble 1.5s infinite ease-in-out alternate;
}
.mg-potion-tubes {
    display: flex;
    gap: 15px;
    justify-content: center;
    width: 100%;
}
.mg-tube {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: transform 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.mg-beaker {
    width: 28px;
    height: 52px;
    border-radius: 4px 4px 12px 12px;
    border: 3px solid #475569;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.mg-beaker-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70%;
}
.mg-beaker-red { background-color: #ef4444; }
.mg-beaker-yellow { background-color: #eab308; }
.mg-beaker-blue { background-color: #3b82f6; }
.mg-tube.selected {
    transform: translateY(-8px) scale(1.05);
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.15));
}
.mg-tube.selected .mg-beaker {
    border-color: #1e293b;
    box-shadow: 0 0 8px rgba(0,0,0,0.3);
}
@keyframes liquidBubble {
    0% { transform: translateY(0) scaleY(1); }
    100% { transform: translateY(-2px) scaleY(1.05); }
}

/* Minijogo 4: Bióloga */
.mg-bio-container {
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.mg-bio-target-box {
    background: #f0fdf4;
    border: 3px solid #bbf7d0;
    border-radius: 1.5rem;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.03);
}
.mg-bio-target-label {
    font-size: 8px;
    font-weight: 900;
    text-transform: uppercase;
    color: #14532d;
    letter-spacing: 0.05em;
}
.mg-bio-target-preview {
    font-size: 2.2rem;
    line-height: 1;
}
.mg-bio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.mg-bio-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    aspect-ratio: 0.82;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 6px 6px 8px 6px;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.15);
    box-shadow: 0 4px 6px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}
.mg-bio-card:active {
    transform: scale(0.94);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
.mg-bio-card-photo {
    width: 100%;
    aspect-ratio: 1;
    background: #f0fdf4;
    border-radius: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 1px solid #dcfce7;
    margin-bottom: 4px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
.mg-bio-card-label {
    font-size: 7px;
    font-weight: 800;
    text-transform: uppercase;
    color: #166534;
    letter-spacing: 0.04em;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Minijogo 5: Aventureira */
.mg-chest-container {
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}
.mg-chest {
    width: 110px;
    height: 110px;
    object-fit: contain;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.08s ease;
    display: inline-block;
}
.mg-chest:active {
    transform: scale(0.9);
}
.mg-chest-shake {
    animation: chestShake 0.12s infinite alternate;
}
.mg-tap-bar-container {
    width: 100%;
    height: 14px;
    background: #f1f5f9;
    border: 2px solid #cbd5e1;
    border-radius: 7px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.mg-tap-bar {
    height: 100%;
    background: linear-gradient(to right, #fbbf24, #d97706);
    width: 0%;
    transition: width 0.1s ease-out;
}
@keyframes chestShake {
    0% { transform: rotate(-4deg); }
    100% { transform: rotate(4deg); }
}

/* --- TELA DE CAPTURA E BIOSCANNER --- */
.camera-flash {
    position: absolute;
    inset: 0;
    background: #ffffff;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
}
.camera-flash.active {
    animation: flashEffect 0.35s ease-out forwards;
}
@keyframes flashEffect {
    0% { opacity: 1; }
    40% { opacity: 1; }
    100% { opacity: 0; }
}

.scanner-laser {
    position: absolute;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(to right, transparent, #10b981, #34d399, #10b981, transparent);
    box-shadow: 0 0 10px #10b981, 0 0 20px #34d399;
    z-index: 20;
    pointer-events: none;
}
.scanner-laser.active {
    animation: scannerScan 2.0s ease-in-out infinite alternate;
}
@keyframes scannerScan {
    0% { top: 0%; }
    100% { top: 100%; }
}

.scanner-radar {
    border: 3px dashed rgba(16, 185, 129, 0.35);
    border-top-color: #10b981;
    animation: radarRotate 4s linear infinite;
}
@keyframes radarRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ficha estilo caderno científico pautado */
.notebook-card {
    background-color: #fefcf0;
    background-image: linear-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 100% 24px;
    line-height: 24px;
    position: relative;
}
.notebook-card::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 28px;
    width: 2px;
    background-color: #fca5a5; /* Margem vermelha do caderno */
}

/* Animação para números subindo sobre os prédios da Eco-Vila */
@keyframes floatUpFade {
    0% {
        transform: translate(-50%, -50%) translateY(0);
        opacity: 0;
        scale: 0.5;
    }
    15% {
        opacity: 1;
        scale: 1.25;
    }
    100% {
        transform: translate(-50%, -50%) translateY(-65px);
        opacity: 0;
        scale: 0.85;
    }
}

.floating-gain {
    position: absolute;
    transform: translate(-50%, -50%);
    font-family: 'Outfit', 'Inter', sans-serif;
    font-weight: 900;
    font-size: 12px;
    color: #fbbf24; /* dourado/amarelo */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), 0 0 8px rgba(251, 191, 36, 0.7);
    pointer-events: none;
    z-index: 99;
    animation: floatUpFade 1.5s cubic-bezier(0.25, 1, 0.50, 1) forwards;
}

/* --- SUPORTE AOS MINI-GAMES APERFEIÇOADOS --- */

/* Canvas de Pesca */
#pescaCanvas {
    width: 100%;
    height: auto;
    max-width: 320px;
    aspect-ratio: 320 / 200;
    border-radius: 2rem;
    border: 4px solid #064e3b;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), inset 0 2px 10px rgba(255,255,255,0.2);
    background: #0284c7;
    cursor: pointer;
    image-rendering: pixelated;
}

/* Layout com Personagem Lateral nos Mini-games */
.mg-layout-with-char {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.mg-char-showcase {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80px;
    width: 100%;
    position: relative;
    overflow: visible;
}

.mg-char-wrapper {
    transform: scale(2.2);
    transform-origin: center bottom;
    image-rendering: pixelated;
    display: inline-block;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
    transition: transform 0.1s ease;
}

/* Ajustes finos nos contêineres de jogos existentes para integrar o personagem */
.mg-horta-wrapper, .mg-lab-wrapper, .mg-bio-wrapper, .mg-chest-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* ==========================================================================
   ECO-VILA FULLSCREEN & EVOLUTION DRAWER CUSTOM STYLES
   ========================================================================== */

#vilaView {
    margin-left: -1rem !important;
    margin-right: -1rem !important;
    margin-top: -1rem !important;
    width: calc(100% + 2rem) !important;
    height: calc(100vh - 148px) !important;
    position: relative;
    overflow: hidden;
}

@media (min-width: 448px) {
    #vilaView {
        /* Adapts to the centered desktop view frame (max-w-md is 448px) */
        width: 448px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

#villageMapContainer {
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* Backdrop escuro e desfocado para o drawer de evoluções */
#drawerBackdrop {
    transition: opacity 0.3s ease;
}

#drawerBackdrop.active {
    display: block !important;
    opacity: 1 !important;
}

/* Drawer deslizante de baixo para cima */
#villageEvolutionDrawer {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
}

#villageEvolutionDrawer.open {
    transform: translateY(0) !important;
}

#villageEvolutionDrawer:not(.open) {
    transform: translateY(100%) !important;
}

/* Rotação e Estilos Imersivos da Eco-Vila */
.animate-bounce-subtle {
    animation: bounce-subtle 2s infinite ease-in-out;
}

/* Fase 7: Eco-Vila jogável tanto em retrato quanto em paisagem (celular, tablet e desktop) */
#landscapePrompt {
    display: none !important;
}

/* Custom Collapsible Side HUD classes */
#villageSideHud {
    position: absolute;
    left: 0;
    top: 60px;
    bottom: 60px;
    width: 215px; /* 180px menu + 35px button */
    z-index: 100;
    display: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateX(-180px); /* collapsed by default */
}

#villageSideHud.open {
    transform: translateX(0); /* expanded */
}

#villageSideHud .side-hud-menu {
    width: 180px;
    height: 100%;
    background: rgba(28, 10, 1, 0.92);
    backdrop-filter: blur(8px);
    border-right: 1px solid rgba(251, 191, 36, 0.3);
    border-top: 1px solid rgba(251, 191, 36, 0.3);
    border-bottom: 1px solid rgba(251, 191, 36, 0.3);
    border-top-right-radius: 24px;
    border-bottom-right-radius: 24px;
    padding: 12px;
    color: #fff;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

#villageSideHud .side-hud-btn {
    width: 35px;
    height: 80px;
    background: #1c0a01;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    border-right: 1px solid rgba(251, 191, 36, 0.3);
    border-top: 1px solid rgba(251, 191, 36, 0.3);
    border-bottom: 1px solid rgba(251, 191, 36, 0.3);
    color: #fbbf24;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 900;
    font-size: 7.5px;
    letter-spacing: 0.1em;
    gap: 4px;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.2);
}

@media (orientation: landscape) {
    body.on-vila-view header {
        display: none !important;
    }
    body.on-vila-view nav {
        display: none !important;
    }
    body.on-vila-view #vilaView {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        margin: 0 !important;
        z-index: 40 !important;
    }
    body.on-vila-view #villageMapContainer {
        width: 100% !important;
        height: 100% !important;
    }
    body.on-vila-view #villageSideHud {
        display: flex !important;
    }
    body.on-vila-view #villageWoodPanel {
        position: fixed !important;
        left: 86.5% !important;
        top: 83% !important;
        bottom: auto !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
        z-index: 10000 !important;
        width: 125px !important;
        padding: 12px 10px !important;
        background: url('assets/ui/wood_button.png') no-repeat center center / 100% 100% !important;
        border: none !important;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4) !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        align-items: center !important;
        justify-content: center !important;
    }
    body.on-vila-view #villageWoodPanel #nextMissionCountdown,
    body.on-vila-view #villageWoodPanel #btnObrasOpen {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
        width: 100% !important;
        height: auto !important;
        padding: 6px 4px !important;
        font-size: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        white-space: nowrap !important;
        margin: 0 !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    }
    body.on-vila-view #villageWoodPanel #nextMissionCountdown {
        border-radius: 9999px !important;
    }
    body.on-vila-view #villageWoodPanel #btnObrasOpen {
        border-radius: 12px !important;
    }
    body.on-vila-view #villageEvolutionDrawer {
        max-width: 800px !important;
        width: 90vw !important;
        max-height: 85vh !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, 100%) !important;
    }
    body.on-vila-view #villageEvolutionDrawer.open {
        transform: translate(-50%, 0) !important;
    }
    body.on-vila-view #villageEvolutionDrawer:not(.open) {
        transform: translate(-50%, 100%) !important;
    }
    body.on-vila-view #villageEvolutionDrawer .px-5.pb-3 {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
        padding-bottom: 0.5rem !important;
        padding-top: 0.5rem !important;
    }
    body.on-vila-view #villageEvolutionDrawer .w-12.h-1.5.bg-gray-300 {
        margin-top: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    body.on-vila-view #villageEvolutionDrawer button[onclick="closeVillageDrawer()"] {
        width: 1.75rem !important;
        height: 1.75rem !important;
        font-size: 0.75rem !important;
    }
    body.on-vila-view #villageEvolutionDrawer .bg-gradient-to-r.from-amber-500.to-amber-600 {
        padding: 0.75rem 1.25rem !important;
        border-radius: 1.5rem !important;
        margin-bottom: 0.75rem !important;
    }
    body.on-vila-view #villageEvolutionDrawer .bg-gradient-to-r.from-amber-500.to-amber-600 p {
        font-size: 8px !important;
    }
    body.on-vila-view #villageEvolutionDrawer .bg-gradient-to-r.from-amber-500.to-amber-600 span.brand-font {
        font-size: 1.25rem !important;
    }
    body.on-vila-view #villageEvolutionDrawer .bg-gradient-to-r.from-amber-500.to-amber-600 button {
        padding: 0.5rem 1rem !important;
        font-size: 9px !important;
        border-radius: 1rem !important;
    }
    body.on-vila-view #villageGrid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }
    /* Compact cards for widescreen evolutions drawer */
    body.on-vila-view .building-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0.65rem 0.75rem !important;
        border-radius: 1.35rem !important;
        gap: 6px !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }
    body.on-vila-view .building-card .flex.items-start.gap-4 {
        align-items: center !important;
        gap: 0.75rem !important;
    }
    body.on-vila-view .building-card .flex-grow.flex.flex-col.gap-2 {
        gap: 4px !important;
    }
    body.on-vila-view .building-card .w-14, 
    body.on-vila-view .building-card .w-12,
    body.on-vila-view .building-card .w-10 {
        width: 2.35rem !important;
        height: 2.35rem !important;
        font-size: 1.25rem !important;
    }
    body.on-vila-view .building-card p.brand-font {
        font-size: 11px !important;
    }
    body.on-vila-view .building-card p.text-\[9px\] {
        font-size: 8px !important;
    }
    body.on-vila-view .building-card button {
        padding: 0.5rem 0.75rem !important;
        font-size: 8.5px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }


    /* Side-by-side Layout for Character Minigames */
    body.on-vila-view .mg-layout-with-char {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-around !important;
        gap: 16px !important;
        height: 100% !important;
        width: 100% !important;
    }
    body.on-vila-view .mg-char-showcase {
        width: 100px !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    body.on-vila-view .mg-horta-grid,
    body.on-vila-view .mg-chest-container,
    body.on-vila-view .mg-lab-container,
    body.on-vila-view .mg-bio-container {
        flex: 1 !important;
        max-width: none !important;
    }

    /* Compact Modals for Character Minigames and Dialogues */
    body.on-vila-view #npcMissionModal > div,
    body.on-vila-view #npcMinigameModal > div,
    body.on-vila-view #npcRewardModal > div {
        max-width: 580px !important;
        min-height: auto !important;
        max-height: 92vh !important;
        padding: 1.25rem !important;
        border-radius: 2rem !important;
        gap: 12px !important;
    }
    body.on-vila-view #npcMissionModal .w-24.h-24 {
        width: 4.5rem !important;
        height: 4.5rem !important;
    }
    body.on-vila-view #npcMissionModal p {
        font-size: 11px !important;
    }
    body.on-vila-view #npcMissionModal button,
    body.on-vila-view #npcMinigameModal button,
    body.on-vila-view #npcRewardModal button {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
        font-size: 10.5px !important;
    }

    /* Make clouds much smaller and fly near the background mountains in landscape */
    body.on-vila-view .cloud-1 {
        width: 7% !important;
        top: 12% !important;
    }
    body.on-vila-view .cloud-2 {
        width: 10% !important;
        top: 18% !important;
    }
    body.on-vila-view .cloud-3 {
        width: 6% !important;
        top: 15% !important;
    }
}

/* ==========================================================================
   VILA 2.5D — SOMBRAS DE CONTATO, ELEVAÇÃO E CELEBRAÇÃO DE UPGRADE
   ========================================================================== */
.village-building-sprite {
    object-fit: contain;
    object-position: bottom center;
    transform-origin: center bottom;
    transform: translate(-50%, -100%) scale(var(--bld-scale, 1));
    filter: drop-shadow(0 8px 7px rgba(15, 38, 12, 0.45));
    will-change: transform;
}

.village-building-sprite:hover,
.village-building-sprite:focus-visible {
    --bld-scale: 1.05;
    filter: drop-shadow(0 12px 12px rgba(15, 38, 12, 0.52)) brightness(1.06);
}

.village-building-sprite:focus-visible {
    outline: 3px solid rgba(251, 191, 36, 0.9);
    outline-offset: 4px;
    border-radius: 1rem;
}

@keyframes buildingUpgradePop {
    0% {
        transform: translate(-50%, -100%) scale(0.86);
        filter: drop-shadow(0 0 18px rgba(253, 224, 71, 0.95)) brightness(1.35);
    }
    45% {
        transform: translate(-50%, -106%) scale(1.10);
        filter: drop-shadow(0 0 24px rgba(251, 191, 36, 0.9)) brightness(1.2);
    }
    100% {
        transform: translate(-50%, -100%) scale(1);
        filter: drop-shadow(0 8px 7px rgba(15, 38, 12, 0.45));
    }
}

.building-upgrade-pop {
    animation: buildingUpgradePop 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Decorações evolutivas da vila por estágio (Estágios 1 a 10) */
.village-decor-prop {
    position: absolute;
    transform: translate(-50%, -100%);
    font-size: clamp(12px, 1.8vw, 22px);
    line-height: 1;
    filter: drop-shadow(0 3px 3px rgba(15, 38, 12, 0.45));
    pointer-events: none;
    user-select: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.village-decor-prop.decor-tree {
    font-size: clamp(16px, 2.4vw, 30px);
}
.village-decor-prop.decor-plaza,
.village-decor-prop.decor-monument {
    font-size: clamp(18px, 2.6vw, 32px);
    filter: drop-shadow(0 4px 6px rgba(15, 38, 12, 0.5));
}
.village-decor-prop.decor-sway {
    animation: decorSway 3.6s ease-in-out infinite;
}
.village-decor-prop.decor-glow,
.village-decor-prop.decor-lantern {
    animation: decorGlowPulse 2.6s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.85));
}
.village-decor-prop.decor-lab-aura {
    animation: decorFloatPulse 3s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.85));
}
.village-decor-prop.decor-legendary {
    font-size: clamp(18px, 2.6vw, 32px);
    animation: decorFloatPulse 2.4s ease-in-out infinite;
    filter: drop-shadow(0 0 12px rgba(250, 204, 21, 0.95));
}
@keyframes decorSway {
    0%, 100% { transform: translate(-50%, -100%) rotate(-3deg); }
    50% { transform: translate(-50%, -100%) rotate(3deg); }
}
@keyframes decorGlowPulse {
    0%, 100% { opacity: 0.82; transform: translate(-50%, -100%) scale(0.96); }
    50% { opacity: 1; transform: translate(-50%, -100%) scale(1.08); }
}
@keyframes decorFloatPulse {
    0%, 100% { transform: translate(-50%, -100%) translateY(0px) scale(0.96); }
    50% { transform: translate(-50%, -100%) translateY(-5px) scale(1.08); }
}

/* Animações leves da Interface de Missões, Evolução e Conquistas */
@keyframes rewardPopIn {
    0% { transform: scale(0.85); opacity: 0; }
    65% { transform: scale(1.04); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.reward-pop-anim {
    animation: rewardPopIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.mission-tab-btn {
    transition: all 0.2s ease;
}
.mission-tab-btn.active {
    background: linear-gradient(135deg, #15803d, #059669);
    color: #fef3c7;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
}

@media (prefers-reduced-motion: reduce) {
    .village-cloud,
    .building-upgrade-pop,
    .world-pin--unlocked .world-pin-dot {
        animation: none !important;
    }
    .village-building-sprite {
        transition: none !important;
    }
}

/* ==========================================================================
   MAPA DO MUNDO — OVERLAY INTERATIVO DOS 9 BIOMAS
   ========================================================================== */
.world-map-viewport {
    touch-action: none;
    cursor: grab;
    background: radial-gradient(circle at 50% 45%, #0c3b4a 0%, #071e26 70%, #051318 100%);
}
.world-map-viewport:active {
    cursor: grabbing;
}

.world-map-pan-layer {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    will-change: transform;
}

/* Mantém exatamente 1672:941 (16:9) contido na tela para que % dos hotspots fique 100% travado na imagem */
.world-map-stage {
    width: min(100%, calc((100vh - 64px) * 1672 / 941));
    aspect-ratio: 1672 / 941;
    max-width: 100%;
    max-height: 100%;
    border-radius: 1rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.world-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    z-index: 15;
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), filter 0.2s ease;
}
.world-pin:hover,
.world-pin:focus-visible {
    transform: translate(-50%, -56%) scale(1.08);
    z-index: 25;
    outline: none;
}

.world-pin-dot {
    width: 38px;
    height: 38px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    position: relative;
}

.world-pin--unlocked .world-pin-dot {
    background: linear-gradient(145deg, #16a34a 0%, #0f766e 100%);
    border: 2.5px solid #fde047;
    box-shadow: 0 0 0 4px rgba(253, 224, 71, 0.28), 0 6px 14px rgba(0, 0, 0, 0.45);
    animation: worldPinPulse 2.6s ease-in-out infinite;
}

.world-pin--current .world-pin-dot {
    background: linear-gradient(145deg, #f59e0b 0%, #d97706 100%);
    border-color: #fef08a;
    box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.36), 0 8px 18px rgba(0, 0, 0, 0.5);
}

@keyframes worldPinPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(253, 224, 71, 0.28), 0 6px 14px rgba(0, 0, 0, 0.45); }
    50%      { box-shadow: 0 0 0 8px rgba(253, 224, 71, 0.48), 0 8px 18px rgba(0, 0, 0, 0.5); }
}

.world-pin--locked {
    filter: saturate(0.45);
}
.world-pin--locked::before {
    content: "";
    position: absolute;
    width: 96px;
    height: 76px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 9999px;
    background: radial-gradient(circle, rgba(15, 23, 42, 0.62) 0%, rgba(15, 23, 42, 0.26) 55%, transparent 78%);
    pointer-events: none;
    z-index: -1;
}
.world-pin--locked .world-pin-dot {
    background: rgba(15, 23, 42, 0.78);
    border: 2px solid rgba(148, 163, 184, 0.55);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}

.world-pin-lock {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 17px;
    height: 17px;
    border-radius: 9999px;
    background: #1e293b;
    border: 1.5px solid #cbd5e1;
    color: #fde68a;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.world-pin-label {
    background: rgba(10, 28, 18, 0.88);
    color: #fef3c7;
    border: 1px solid rgba(251, 191, 36, 0.45);
    padding: 2px 7px;
    border-radius: 9999px;
    font-size: 9.5px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}

.world-pin--locked .world-pin-label {
    background: rgba(15, 23, 42, 0.84);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.35);
}

.world-pin-sub {
    font-size: 7.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fde68a;
    background: rgba(15, 23, 42, 0.76);
    padding: 1px 6px;
    border-radius: 9999px;
    white-space: nowrap;
}

/* ==========================================================================
   FASE 3 — MOBILE-FIRST, SAFE AREAS, DVH/SVH, CLAMP() E ACESSIBILIDADE
   ========================================================================== */
:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

html, body {
    min-height: 100vh;
    min-height: 100dvh;
}

.capy-header-glass {
    padding-top: calc(0.75rem + var(--safe-top));
    padding-left: calc(1rem + var(--safe-left));
    padding-right: calc(1rem + var(--safe-right));
}

.capy-bottom-dock {
    padding-bottom: calc(0.75rem + var(--safe-bottom));
    padding-left: calc(0.5rem + var(--safe-left));
    padding-right: calc(0.5rem + var(--safe-right));
}

.capy-bottom-dock button {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
}

#mainMenuScreen {
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

#worldMapModal {
    height: 100vh;
    height: 100dvh;
}

/* Bloqueia zoom nativo da página apenas dentro dos mapas interativos */
#villageMapContainer,
#worldMapViewport {
    touch-action: none;
}

/* Tipografia fluida nos títulos principais */
.capy-hero-banner h2 {
    font-size: clamp(1.35rem, 4.5vw, 1.9rem);
}

/* Foco visível acessível em botões e links */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(251, 191, 36, 0.9);
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .world-pin-dot {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    .world-pin-label {
        font-size: 7.5px;
        padding: 1.5px 5px;
    }
    .world-pin-sub {
        font-size: 6.5px;
    }
    .world-pin--locked::before {
        width: 66px;
        height: 54px;
    }
}

@media (max-width: 360px) {
    .capy-bottom-dock button span {
        font-size: 8px;
    }
    .capy-header-glass {
        padding-left: 0.65rem;
        padding-right: 0.65rem;
    }
}







/* ============================================================================
   OTIMIZAÇÃO GPU ANDROID / FULLSCREEN (v106)
   - Evita re-blur contínuo de backdrop-filter sobre o Canvas animado da Vila
   - Promove #villageZoomContainer para camada GPU dedicada
   ============================================================================ */
#villageZoomContainer {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

@media (hover: none) and (pointer: coarse) {
    #vilaView .backdrop-blur,
    #vilaView .backdrop-blur-sm,
    #vilaView .backdrop-blur-md,
    .capy-header-glass,
    .capy-bottom-dock {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

/* ============================================================================
   MINIJOGOS DE MISSÃO DOS PERSONAGENS — TELA CHEIA HORIZONTAL + PERFORMANCE (v107)
   ============================================================================ */
#mainMenuScreen.hidden *,
#vilaView.hidden * {
    animation-play-state: paused !important;
}

@media (hover: none) and (pointer: coarse) {
    #npcMissionModal,
    #npcMinigameModal,
    #npcRewardModal,
    #settingsModal,
    #worldMapModal {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

#npcMinigameModal .mg-layout-with-char {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    justify-content: center;
    gap: clamp(16px, 3vw, 40px);
    width: 100%;
    height: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 8px 12px;
}

#npcMinigameModal .mg-char-showcase {
    flex: 0 0 auto;
    width: clamp(110px, 22vw, 180px);
    height: clamp(110px, 28dvh, 180px);
    border-radius: 2rem;
    background: radial-gradient(circle at 50% 45%, #fef9c3, #d1fae5);
    border: 4px solid #fcd34d;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(6, 78, 59, 0.14);
}

#npcMinigameModal .mg-char-wrapper {
    transform: scale(2.6);
    transform-origin: center;
}

/* Horta em tela cheia horizontal */
#npcMinigameModal .mg-horta-grid {
    max-width: min(56dvh, 420px) !important;
    width: 100%;
    gap: clamp(10px, 1.8vw, 16px) !important;
}
#npcMinigameModal .mg-vegetable {
    width: 72% !important;
    height: 72% !important;
}
#npcMinigameModal .mg-vegetable.up {
    bottom: 12% !important;
}

/* Pesca em tela cheia horizontal */
#npcMinigameModal .mg-fishing-container {
    max-width: min(92vw, 760px) !important;
    width: 100% !important;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
#npcMinigameModal #pescaCanvas {
    width: 100% !important;
    max-width: 720px;
    max-height: 68dvh;
    height: auto !important;
    aspect-ratio: 320 / 200;
    border-radius: 1.5rem;
    border: 4px solid #0369a1;
    box-shadow: 0 12px 28px rgba(2, 132, 199, 0.25);
    cursor: pointer;
}

/* Laboratório em tela cheia horizontal */
#npcMinigameModal .mg-lab-container {
    max-width: 520px !important;
    width: 100%;
    gap: 18px !important;
}
#npcMinigameModal .mg-potion-target {
    width: clamp(96px, 20dvh, 130px) !important;
    height: clamp(96px, 20dvh, 130px) !important;
}
#npcMinigameModal .mg-beaker {
    width: 48px !important;
    height: 82px !important;
}
#npcMinigameModal .mg-potion-tubes {
    gap: clamp(18px, 4vw, 36px) !important;
}

/* Bióloga em tela cheia horizontal */
#npcMinigameModal .mg-bio-container {
    max-width: 560px !important;
    width: 100%;
    gap: 14px !important;
}
#npcMinigameModal .mg-bio-grid {
    gap: 12px !important;
}
#npcMinigameModal .mg-bio-card-photo {
    font-size: clamp(2.2rem, 6dvh, 3.2rem) !important;
}
#npcMinigameModal .mg-bio-card-label {
    font-size: 11px !important;
}

/* Aventureira (Baú) em tela cheia horizontal */
#npcMinigameModal .mg-chest-container {
    max-width: 480px !important;
    width: 100%;
}

/* Fallback limpo se o celular estiver em retrato estreito */
@media (max-width: 520px) and (orientation: portrait) {
    #npcMinigameModal .mg-layout-with-char {
        flex-direction: column !important;
        gap: 14px;
    }
    #npcMinigameModal .mg-char-showcase {
        width: 96px;
        height: 96px;
    }
    #npcMinigameModal .mg-char-wrapper {
        transform: scale(2.0);
    }
}
