Spaces:
Running
Running
Download index.html from marcesoftcorp/gameserve: direct link, hf CLI and curl.
- Browser
- Download file 56.8 kB
-
https://huggingface.co/spaces/marcesoftcorp/gameserve/resolve/main/index.html
- Command line
-
hf download hf://spaces/marcesoftcorp/gameserve/index.html
-
curl -L -o index.html https://huggingface.co/spaces/marcesoftcorp/gameserve/resolve/main/index.html
56.8 kB
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Futebol 3D V16 - Campeonato Personalizado, Upload Local, Replay Dinâmico & Mobile Pro</title>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
user-select: none;
-webkit-user-select: none;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
touch-action: manipulation;
}
body {
width: 100vw;
height: 100vh;
overflow: hidden;
background-color: #03030a;
color: white;
}
#game-canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
}
/* MENU PRINCIPAL & EDIÇÃO MOBILE */
#menu-screen {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: radial-gradient(circle, rgba(10,20,40,0.96) 0%, rgba(2,3,8,0.99) 100%);
z-index: 100;
display: flex;
align-items: center;
justify-content: center;
gap: 25px;
overflow-y: auto;
padding: 15px;
}
.menu-panel {
background: rgba(255, 255, 255, 0.05);
padding: 18px;
border-radius: 14px;
border: 1px solid rgba(0, 255, 204, 0.2);
width: 440px;
max-width: 100%;
box-shadow: 0 10px 35px rgba(0,0,0,0.85);
backdrop-filter: blur(12px);
max-height: 96vh;
overflow-y: auto;
}
.menu-panel h1 {
text-align: center;
color: #00ffcc;
margin-bottom: 10px;
font-size: 1.5rem;
text-shadow: 0 0 12px rgba(0,255,204,0.6);
}
.mobile-edition-badge {
background: linear-gradient(135deg, #00ffcc, #0088ff);
color: #000;
font-weight: 900;
font-size: 0.75rem;
text-align: center;
padding: 4px;
border-radius: 6px;
margin-bottom: 12px;
text-transform: uppercase;
box-shadow: 0 0 10px rgba(0,255,204,0.4);
}
.form-group { margin-bottom: 8px; }
.form-group label { display: block; font-size: 0.78rem; color: #aaa; margin-bottom: 2px; }
.form-group input, .form-group select, .form-group textarea {
width: 100%;
padding: 7px 10px;
border-radius: 6px;
border: 1px solid #444;
background: #1a1a24;
color: #fff;
font-size: 0.85rem;
font-weight: bold;
}
.file-upload-box {
background: rgba(0, 255, 204, 0.05);
border: 1px dashed rgba(0, 255, 204, 0.4);
padding: 8px;
border-radius: 6px;
margin-top: 4px;
}
.file-upload-box input[type="file"] { font-size: 0.75rem; color: #00ffcc; cursor: pointer; }
.checkbox-group {
display: flex;
align-items: center;
gap: 10px;
margin: 6px 0;
font-size: 0.82rem;
color: #ddd;
cursor: pointer;
}
.checkbox-group input { width: 16px; height: 16px; cursor: pointer; }
.desktop-options-box, .custom-champ-box {
background: rgba(0, 255, 204, 0.05);
border: 1px dashed rgba(0, 255, 204, 0.3);
padding: 10px;
border-radius: 8px;
margin-bottom: 8px;
display: none;
}
.color-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.color-row div { display: flex; align-items: center; gap: 8px; }
input[type="color"] { border: none; width: 32px; height: 28px; background: none; cursor: pointer; }
#btn-start {
width: 100%;
padding: 10px;
background: #00ffcc;
color: #000;
font-weight: 900;
font-size: 1rem;
border: none;
border-radius: 8px;
cursor: pointer;
transition: 0.2s;
margin-top: 5px;
}
#btn-start:hover { background: #00ccaa; transform: scale(1.02); }
/* CARTINHA FUT */
.fut-card {
width: 220px;
background: linear-gradient(135deg, #FFD700, #B8860B, #FF8C00);
border-radius: 10px 10px 35px 10px;
padding: 12px;
color: #111;
box-shadow: 0 15px 35px rgba(255, 215, 0, 0.25);
border: 2px solid #FFF8DC;
}
.fut-top { display: flex; justify-content: space-between; align-items: flex-start; }
.fut-ovr { font-size: 2.1rem; font-weight: 900; line-height: 0.8; }
.fut-pos { font-size: 0.85rem; font-weight: bold; }
.fut-image {
width: 75px; height: 75px; background: rgba(0,0,0,0.1);
border-radius: 50%; margin: 6px auto; display: flex;
align-items: center; justify-content: center; font-size: 2.3rem;
}
.fut-name {
text-align: center; font-size: 1rem; font-weight: 900;
border-bottom: 2px solid rgba(0,0,0,0.2); padding-bottom: 3px; margin-bottom: 6px;
}
.fut-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; font-weight: 800; font-size: 0.75rem; }
.upgrade-btn {
background: #111; color: #FFD700; border: none; width: 100%;
padding: 5px; margin-top: 5px; border-radius: 5px; cursor: pointer; font-weight: bold; font-size: 0.75rem;
}
.upgrade-btn:hover { background: #333; }
/* HUD TV & PLACAR AO VIVO */
#hud-screen {
position: absolute; top: 0; left: 0; width: 100%; height: 100%;
z-index: 10; pointer-events: none; display: none;
}
.scoreboard-container {
position: absolute; top: 15px; left: 15px; display: flex;
align-items: center; background: rgba(0, 0, 0, 0.88); padding: 6px 12px;
border-radius: 8px; border-left: 5px solid #00ffcc;
box-shadow: 0 4px 15px rgba(0,0,0,0.6); pointer-events: auto; gap: 8px;
}
.tv-logo { height: 26px; max-width: 70px; object-fit: contain; background: rgba(255, 255, 255, 0.1); padding: 2px 4px; border-radius: 4px; }
.champ-logo-hud { height: 26px; max-width: 70px; object-fit: contain; display: none; border-radius: 4px; }
.live-badge {
background: #ff0000; color: white; font-weight: 900; font-size: 0.65rem;
padding: 2px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: 1px;
animation: blinkLive 1.2s infinite;
}
@keyframes blinkLive { 50% { opacity: 0.4; } }
.teams-score { display: flex; align-items: center; font-size: 0.95rem; font-weight: bold; color: #fff; }
.score-box { background: #222; padding: 2px 8px; margin: 0 6px; border-radius: 4px; color: #00ffcc; font-size: 1rem; }
.match-timer { background: #151522; color: #ffcc00; padding: 3px 6px; border-radius: 4px; font-size: 0.85rem; font-family: monospace; }
/* CONTROLES MOBILE APRIMORADOS */
#mobile-controls {
position: absolute; bottom: 0; left: 0; width: 100%; height: 100%;
z-index: 25; pointer-events: none; display: none;
}
.virtual-dpad {
position: absolute; bottom: 25px; left: 25px; width: 150px; height: 150px;
pointer-events: auto;
}
.dpad-btn {
position: absolute; background: rgba(255, 255, 255, 0.18); border: 2px solid rgba(255,255,255,0.4);
color: white; font-weight: bold; display: flex; align-items: center; justify-content: center;
border-radius: 14px; font-size: 1.3rem; cursor: pointer; transition: background 0.1s;
}
.dpad-btn:active, .dpad-btn.active { background: rgba(0, 255, 204, 0.6); border-color: #00ffcc; transform: scale(0.95); }
#dp-up { top: 0; left: 50px; width: 50px; height: 48px; }
#dp-down { bottom: 0; left: 50px; width: 50px; height: 48px; }
#dp-left { top: 50px; left: 0; width: 48px; height: 50px; }
#dp-right { top: 50px; right: 0; width: 48px; height: 50px; }
#dp-center { top: 50px; left: 50px; width: 50px; height: 50px; background: rgba(0,0,0,0.4); border-radius: 50%; }
.virtual-actions {
position: absolute; bottom: 35px; right: 25px; display: flex; gap: 15px; pointer-events: auto;
}
.action-btn {
width: 75px; height: 75px; background: rgba(0, 255, 204, 0.25); border: 3px solid #00ffcc;
border-radius: 50%; color: #fff; font-weight: 900; font-size: 0.95rem; display: flex;
align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(0,255,204,0.4);
cursor: pointer;
}
.action-btn:active { background: rgba(0, 255, 204, 0.7); transform: scale(0.92); }
/* TELA DIVIDIDA DA FAN ZONE */
#split-screen-container {
position: absolute; top: 0; left: 0; width: 100%; height: 100%;
z-index: 60; display: none; grid-template-columns: 1fr 1fr;
border: 6px solid #00ffcc; background: #000;
animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.split-box {
position: relative; height: 100%; overflow: hidden;
display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
border-right: 4px solid #00ffcc;
}
.split-box:last-child { border-right: none; }
.split-label {
position: absolute; top: 20px; background: rgba(0,0,0,0.85); color: #00ffcc;
padding: 8px 20px; border-radius: 20px; font-weight: 900; font-size: 1.05rem;
border: 2px solid #00ffcc; z-index: 10; text-transform: uppercase;
}
.split-content-bg {
position: absolute; top: 0; left: 0; width: 100%; height: 100%;
background-size: cover; background-position: center; filter: brightness(0.7);
}
.split-info-card {
position: relative; z-index: 5; background: rgba(0,0,0,0.85); width: 85%;
margin-bottom: 30px; padding: 18px; border-radius: 12px; text-align: center;
border: 1px solid rgba(255,255,255,0.2); box-shadow: 0 10px 30px rgba(0,0,0,0.9);
}
.split-info-card h2 { color: #ffcc00; font-size: 1.6rem; margin-bottom: 5px; text-shadow: 0 0 10px rgba(255,204,0,0.6); }
.split-info-card p { font-size: 0.95rem; color: #fff; font-weight: bold; }
/* VINHETA DE TV / WIPE */
#replay-wipe {
position: absolute; top: 0; left: 0; width: 100%; height: 100%;
background: linear-gradient(95deg, rgba(2,5,15,0.98), rgba(0, 255, 204, 0.96), rgba(2,5,15,0.98));
z-index: 70; display: flex; align-items: center; justify-content: center;
transform: translateX(-100%);
pointer-events: none;
}
#replay-wipe.active {
animation: smoothTvWipe 1.4s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}
@keyframes smoothTvWipe {
0% { transform: translateX(-100%); }
45% { transform: translateX(0%); }
55% { transform: translateX(0%); }
100% { transform: translateX(100%); }
}
#replay-wipe img {
height: 120px;
filter: drop-shadow(0 0 25px #00ffcc);
animation: pulseLogo 0.7s infinite alternate;
}
@keyframes pulseLogo {
from { transform: scale(1); filter: drop-shadow(0 0 15px #00ffcc); }
to { transform: scale(1.12); filter: drop-shadow(0 0 30px #ffffff); }
}
.cam-status {
position: absolute; top: 15px; right: 15px; background: #ff0000; color: white;
padding: 6px 14px; font-weight: bold; border-radius: 5px; display: none; font-size: 0.85rem;
animation: blink 1s infinite; pointer-events: auto;
z-index: 75;
}
@keyframes blink { 50% { opacity: 0.4; } }
.controls-info {
position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%);
background: rgba(0,0,0,0.75); padding: 6px 15px; border-radius: 20px;
font-size: 0.75rem; border: 1px solid rgba(255,255,255,0.2); pointer-events: auto;
text-align: center; width: max-content; max-width: 95%;
}
@media(max-width: 768px) {
#menu-screen { flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 10px; }
.controls-info { display: none; }
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://unpkg.com/peerjs@1.4.7/dist/peerjs.min.js"></script>
</head>
<body>
<div id="game-canvas"></div>
<!-- TELA DIVIDIDA DA FAN ZONE 3D -->
<div id="split-screen-container">
<div class="split-box">
<div class="split-label">🏟️ ESTÁDIO - FOGOS & TORCIDA</div>
<div class="split-content-bg" style="background: radial-gradient(circle, #112233 0%, #020208 100%);"></div>
<div class="split-info-card">
<h2>GOOOOOL!</h2>
<p id="stadium-goal-text">EXPLOSÃO DE ALEGRIA NO GRAMADO!</p>
</div>
</div>
<div class="split-box">
<div class="split-label" id="fanzone-city-title">📍 FAN ZONE 3D MONUMENTAL</div>
<div id="fanzone-3d-container" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></div>
<div class="split-info-card">
<h2 id="fanzone-city-name">LONDRES / NY / RIO</h2>
<p id="fanzone-desc">TELÕES, MONUMENTOS E FOGOS 3D EM FESTA!</p>
</div>
</div>
</div>
<!-- VINHETA / ANIMAÇÃO DA EMISSORA DE TV -->
<div id="replay-wipe">
<img id="wipe-tv-logo" src="" alt="TV Logo">
</div>
<div class="cam-status" id="cam-status">🎥 REPLAY DINÂMICO DO LANCE</div>
<div id="menu-screen">
<div class="menu-panel">
<h1>FUTEBOL 3D V16</h1>
<div class="mobile-edition-badge">📱 Mobile Pro & Campeonato Personalizado</div>
<div class="form-group">
<label>Plataforma de Jogo:</label>
<select id="device-platform">
<option value="desktop">Computador (Desktop)</option>
<option value="mobile" selected>Celular (Mobile Edition)</option>
</select>
</div>
<!-- OPÇÕES DESKTOP -->
<div class="desktop-options-box" id="desktop-options-panel">
<label style="color:#00ffcc; font-weight:bold; margin-bottom:6px; display:block;">⚙️ Configurações Desktop:</label>
<div class="checkbox-group">
<input type="checkbox" id="chk-helicopter" checked>
<label for="chk-helicopter" style="margin:0; color:#fff;">Câmera de Helicóptero na Entrada</label>
</div>
</div>
<div class="form-group">
<label>Modo de Jogo:</label>
<select id="game-mode">
<option value="single">1 Jogador (Amistoso vs Máquina + Gk)</option>
<option value="multi">2 Jogadores (Amistoso Local)</option>
<option value="custom-champ">🏆 Criar Campeonato Personalizado</option>
</select>
</div>
<!-- CONFIGURAÇÕES DE CAMPEONATO PERSONALIZADO (UPLOAD LOCAL) -->
<div class="custom-champ-box" id="custom-champ-panel">
<label style="color:#00ffcc; font-weight:bold; margin-bottom:6px; display:block;">🏆 Dados do Campeonato:</label>
<div class="form-group">
<label>Nome do Campeonato:</label>
<input type="text" id="champ-name-input" value="COPA MUNICIPAL 2026">
</div>
<div class="form-group">
<label>Enviar Logo do Campeonato (Dispositivo):</label>
<div class="file-upload-box">
<input type="file" id="file-champ-logo" accept="image/*">
</div>
</div>
<div class="form-group">
<label>Enviar Imagem da Taça (Dispositivo):</label>
<div class="file-upload-box">
<input type="file" id="file-champ-trophy" accept="image/*">
</div>
</div>
</div>
<div class="form-group">
<label>Nome do Jogador 1 (Casa):</label>
<input type="text" id="player-name" value="PELÉ">
</div>
<div class="form-group" id="p2-name-group" style="display:none;">
<label>Nome do Jogador 2 (Fora):</label>
<input type="text" id="player2-name" value="MARADONA">
</div>
<div class="form-group">
<label>Time Casa:</label>
<input type="text" id="home-team" value="SANTOS FC">
</div>
<div class="form-group">
<label>Time Fora:</label>
<input type="text" id="away-team" value="RIVAL FC">
</div>
<div class="color-row">
<div>
<label>Cor Casa:</label>
<input type="color" id="home-color" value="#ffffff">
</div>
<div>
<label>Cor Fora:</label>
<input type="color" id="away-color" value="#ff0000">
</div>
</div>
<div class="form-group">
<label>Emissora de TV Transmissora:</label>
<select id="tv-channel">
<option value="https://upload.wikimedia.org/wikipedia/commons/e/ee/CBS_logo_%282020%29.svg">CBS Sports</option>
<option value="https://ichef.bbci.co.uk/images/ic/400x225/p0f2ssyx.jpg">BBC Sport</option>
<option value="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/ESPN_wordmark.svg/1280px-ESPN_wordmark.svg.png">ESPN</option>
</select>
</div>
<button id="btn-start">JOGAR PARTIDA</button>
</div>
<div class="fut-card">
<div class="fut-top">
<div>
<div class="fut-ovr" id="ui-ovr">85</div>
<div class="fut-pos">ATA</div>
</div>
</div>
<div class="fut-image">⚽</div>
<div class="fut-name" id="ui-name">PELÉ</div>
<div class="fut-stats">
<div>PAC: <span id="ui-pac">82</span></div>
<div>SHO: <span id="ui-sho">86</span></div>
<div>DRI: <span id="ui-dri">87</span></div>
<div>XP: <span id="ui-xp">100</span></div>
</div>
<button class="upgrade-btn" id="btn-up-pac">⬆️ +1 PAC (Custa 20 XP)</button>
<button class="upgrade-btn" id="btn-up-sho">⬆️ +1 SHO (Custa 20 XP)</button>
</div>
</div>
<!-- HUD TV & PLACAR -->
<div id="hud-screen">
<div class="scoreboard-container">
<img id="hud-tv-logo" class="tv-logo" src="" alt="TV">
<img id="hud-champ-logo" class="champ-logo-hud" src="" alt="Champ Logo">
<div class="live-badge">AO VIVO</div>
<div class="teams-score">
<span id="hud-home">CASA</span>
<span class="score-box" id="hud-score">0 - 0</span>
<span id="hud-away">FORA</span>
</div>
<div class="match-timer" id="hud-timer">05:00</div>
</div>
<div class="controls-info" id="desktop-controls-info">
[P1: W,A,S,D + ESPAÇO] | Edição Mobile Pro Ativa com Controles Touch Otimizados
</div>
</div>
<!-- CONTROLES MOBILE APRIMORADOS -->
<div id="mobile-controls">
<div class="virtual-dpad">
<div id="dp-center"></div>
<div class="dpad-btn" id="dp-up">▲</div>
<div class="dpad-btn" id="dp-down">▼</div>
<div class="dpad-btn" id="dp-left">◄</div>
<div class="dpad-btn" id="dp-right">►</div>
</div>
<div class="virtual-actions">
<div class="action-btn" id="btn-kick">CHUTE</div>
</div>
</div>
<script>
let playerData = { name: "PELÉ", p2Name: "MARADONA", homeTeam: "SANTOS FC", awayTeam: "RIVAL FC", ovr: 85, pac: 82, sho: 86, dri: 87, xp: 100, mode: "single", champName: "" };
let desktopSettings = { platform: "mobile", helicopter: false };
let homeScore = 0, awayScore = 0, matchTime = 300, matchInterval = null;
let gameInitialized = false;
let customChampLogoData = null;
let customChampTrophyData = null;
// Plataforma padrão mobile
const platformSelect = document.getElementById('device-platform');
const mobileControlsDiv = document.getElementById('mobile-controls');
mobileControlsDiv.style.display = 'block';
platformSelect.addEventListener('change', (e) => {
desktopSettings.platform = e.target.value;
const desktopBox = document.getElementById('desktop-options-panel');
if (desktopSettings.platform === 'desktop') {
desktopBox.style.display = 'block';
mobileControlsDiv.style.display = 'none';
} else {
desktopBox.style.display = 'none';
mobileControlsDiv.style.display = 'block';
}
});
document.getElementById('chk-helicopter').addEventListener('change', (e) => { desktopSettings.helicopter = e.target.checked; });
// Manipulação de Uploads Locais do Dispositivo
document.getElementById('file-champ-logo').addEventListener('change', (e) => {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
customChampLogoData = event.target.result;
};
reader.readAsDataURL(file);
}
});
document.getElementById('file-champ-trophy').addEventListener('change', (e) => {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
customChampTrophyData = event.target.result;
};
reader.readAsDataURL(file);
}
});
document.getElementById('game-mode').addEventListener('change', (e) => {
playerData.mode = e.target.value;
const p2Group = document.getElementById('p2-name-group');
const champPanel = document.getElementById('custom-champ-panel');
if (playerData.mode === 'multi') {
p2Group.style.display = 'block';
champPanel.style.display = 'none';
} else if (playerData.mode === 'custom-champ') {
p2Group.style.display = 'none';
champPanel.style.display = 'block';
} else {
p2Group.style.display = 'none';
champPanel.style.display = 'none';
}
});
function updateCard() {
playerData.ovr = Math.floor((playerData.pac + playerData.sho + playerData.dri) / 3);
document.getElementById('ui-ovr').innerText = playerData.ovr;
document.getElementById('ui-pac').innerText = playerData.pac;
document.getElementById('ui-sho').innerText = playerData.sho;
document.getElementById('ui-dri').innerText = playerData.dri;
document.getElementById('ui-xp').innerText = playerData.xp;
playerData.name = document.getElementById('player-name').value.toUpperCase() || "JOGADOR";
document.getElementById('ui-name').innerText = playerData.name;
}
document.getElementById('player-name').addEventListener('input', updateCard);
document.getElementById('btn-up-pac').addEventListener('click', () => { if (playerData.xp >= 20) { playerData.xp -= 20; playerData.pac++; updateCard(); } });
document.getElementById('btn-up-sho').addEventListener('click', () => { if (playerData.xp >= 20) { playerData.xp -= 20; playerData.sho++; updateCard(); } });
document.getElementById('btn-start').addEventListener('click', () => {
playerData.homeTeam = document.getElementById('home-team').value.toUpperCase();
playerData.awayTeam = document.getElementById('away-team').value.toUpperCase();
playerData.p2Name = document.getElementById('player2-name').value.toUpperCase();
playerData.champName = document.getElementById('champ-name-input').value.toUpperCase();
const tvLogoUrl = document.getElementById('tv-channel').value;
document.getElementById('hud-home').innerText = playerData.homeTeam;
document.getElementById('hud-away').innerText = playerData.awayTeam;
document.getElementById('hud-tv-logo').src = tvLogoUrl;
document.getElementById('wipe-tv-logo').src = tvLogoUrl;
// Se for campeonato personalizado, exibe a logo do campeonato enviada pelo usuário ao lado da TV
const hudChampLogo = document.getElementById('hud-champ-logo');
if (playerData.mode === 'custom-champ' && customChampLogoData) {
hudChampLogo.src = customChampLogoData;
hudChampLogo.style.display = 'block';
} else {
hudChampLogo.style.display = 'none';
}
document.getElementById('menu-screen').style.display = 'none';
document.getElementById('hud-screen').style.display = 'block';
if (desktopSettings.platform === 'mobile' || 'ontouchstart' in window || navigator.maxTouchPoints > 0) {
document.getElementById('mobile-controls').style.display = 'block';
}
if (!gameInitialized) {
init3DGame(document.getElementById('home-color').value, document.getElementById('away-color').value);
gameInitialized = true;
} else {
gameState = desktopSettings.helicopter ? 'INTRO' : 'PLAYING';
introTimer = 0;
resetBallAndPlayers();
}
startMatchTimer();
});
function startMatchTimer() {
if (matchInterval) clearInterval(matchInterval);
matchInterval = setInterval(() => {
if (gameState === 'PLAYING') {
matchTime--;
let min = Math.floor(matchTime / 60), sec = matchTime % 60;
document.getElementById('hud-timer').innerText = `${min < 10 ? '0' : ''}${min}:${sec < 10 ? '0' : ''}${sec}`;
if (matchTime <= 0) {
clearInterval(matchInterval);
if (playerData.mode === 'custom-champ' && homeScore !== awayScore) {
triggerTrophyLiftSequence(homeScore > awayScore);
} else {
alert(`FIM DE JOGO!\nPlacar: ${playerData.homeTeam} ${homeScore} x ${awayScore} ${playerData.awayTeam}`);
location.reload();
}
}
}
}, 1000);
}
let touchKeys = { KeyW: false, KeyS: false, KeyA: false, KeyD: false, Space: false };
function setupTouchControls() {
const bindTouch = (id, code) => {
const el = document.getElementById(id);
if (!el) return;
el.addEventListener('touchstart', (e) => { e.preventDefault(); touchKeys[code] = true; el.classList.add('active'); });
el.addEventListener('touchend', (e) => { e.preventDefault(); touchKeys[code] = false; el.classList.remove('active'); });
el.addEventListener('mousedown', (e) => { touchKeys[code] = true; el.classList.add('active'); });
el.addEventListener('mouseup', (e) => { touchKeys[code] = false; el.classList.remove('active'); });
};
bindTouch('dp-up', 'KeyW'); bindTouch('dp-down', 'KeyS');
bindTouch('dp-left', 'KeyA'); bindTouch('dp-right', 'KeyD');
bindTouch('btn-kick', 'Space');
}
setupTouchControls();
// --- THREE.JS ENGINE ---
let scene, camera, renderer, ball, playerObj, p2Obj, homeGk, awayGk;
let crowdSpectators = [], fireworks = [];
let keys = {};
let gameState = 'INTRO', introTimer = 0, goalTimer = 0;
let fzScene, fzCamera, fzRenderer, fzSpectators = [], fzFireworks = [];
let trophyGroup = null;
const globalFanZones = [
{ name: "LONDRES - BIG BEN", desc: "MULTIDÃO, TELÕES GIGANTES E TORRE DO RELÓGIO EM FESTA!" },
{ name: "NOVA YORK - TIMES SQUARE", desc: "TELÕES DE LED, MONUMENTOS E ARRANHA-CÉUS CELEBRANDO!" },
{ name: "RIO DE JANEIRO - CRISTO REDENTOR", desc: "MONUMENTO HISTÓRICO, FOGOS E SAMBA 3D NA PRAIA!" }
];
function init3DGame(colorHome, colorAway) {
const container = document.getElementById('game-canvas');
scene = new THREE.Scene();
scene.background = new THREE.Color(0x030315);
scene.fog = new THREE.FogExp2(0x030315, 0.002);
camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 1000);
renderer = new THREE.WebGLRenderer({ antialias: true, powerPreference: "high-performance" });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = false;
container.appendChild(renderer.domElement);
scene.add(new THREE.AmbientLight(0xffffff, 0.6));
const dirLight = new THREE.DirectionalLight(0xffffff, 0.7);
dirLight.position.set(30, 80, 30);
scene.add(dirLight);
const fieldGeo = new THREE.PlaneGeometry(80, 110);
const fieldMat = new THREE.MeshLambertMaterial({ color: 0x1f7a3e });
const field = new THREE.Mesh(fieldGeo, fieldMat);
field.rotation.x = -Math.PI / 2;
scene.add(field);
const lineMat = new THREE.MeshBasicMaterial({ color: 0xffffff });
const centerLine = new THREE.Mesh(new THREE.PlaneGeometry(80, 0.8), lineMat);
centerLine.rotation.x = -Math.PI / 2; centerLine.position.y = 0.05;
scene.add(centerLine);
const midCircle = new THREE.Mesh(new THREE.CylinderGeometry(8, 8, 0.1, 32), lineMat);
midCircle.position.y = 0.05; scene.add(midCircle);
const midInner = new THREE.Mesh(new THREE.CylinderGeometry(7.4, 7.4, 0.11, 32), fieldMat);
midInner.position.y = 0.06; scene.add(midInner);
buildGoalWithNet(-50);
buildGoalWithNet(50);
buildLowAdBoards();
buildProfessionalStadium();
buildMassiveHumanoidCrowd();
buildCity3D();
const pGeo = new THREE.CylinderGeometry(1, 1, 3);
playerObj = new THREE.Mesh(pGeo, new THREE.MeshLambertMaterial({ color: colorHome }));
playerObj.position.set(0, 1.5, 20); scene.add(playerObj);
p2Obj = new THREE.Mesh(pGeo, new THREE.MeshLambertMaterial({ color: colorAway }));
p2Obj.position.set(0, 1.5, -20); scene.add(p2Obj);
const gkGeo = new THREE.CylinderGeometry(0.9, 0.9, 2.8);
homeGk = new THREE.Mesh(gkGeo, new THREE.MeshLambertMaterial({ color: 0xffff00 }));
homeGk.position.set(0, 1.4, 48); scene.add(homeGk);
awayGk = new THREE.Mesh(gkGeo, new THREE.MeshLambertMaterial({ color: 0x00ffff }));
awayGk.position.set(0, 1.4, -48); scene.add(awayGk);
ball = new THREE.Mesh(new THREE.SphereGeometry(0.8, 16, 16), new THREE.MeshLambertMaterial({ color: 0xffffff }));
ball.position.set(0, 0.8, 0); scene.add(ball);
ball.velocity = new THREE.Vector3(0,0,0);
window.addEventListener('keydown', (e) => keys[e.code] = true);
window.addEventListener('keyup', (e) => keys[e.code] = false);
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
if (!desktopSettings.helicopter) {
gameState = 'PLAYING';
} else {
launchFireworks(4);
}
requestAnimationFrame(gameLoop);
}
function buildGoalWithNet(z) {
const pMat = new THREE.MeshLambertMaterial({ color: 0xffffff });
const p1 = new THREE.Mesh(new THREE.CylinderGeometry(0.3,0.3,6), pMat); p1.position.set(-6,3,z);
const p2 = new THREE.Mesh(new THREE.CylinderGeometry(0.3,0.3,6), pMat); p2.position.set(6,3,z);
const cb = new THREE.Mesh(new THREE.CylinderGeometry(0.3,0.3,12.6), pMat); cb.rotation.z = Math.PI/2; cb.position.set(0,6,z);
scene.add(p1, p2, cb);
const netGeo = new THREE.BoxGeometry(12.4, 5.8, 3);
const netMat = new THREE.MeshBasicMaterial({ color: 0xcccccc, wireframe: true, transparent: true, opacity: 0.25 });
const net = new THREE.Mesh(netGeo, netMat);
net.position.set(0, 2.9, z < 0 ? z - 1.5 : z + 1.5);
scene.add(net);
}
function buildLowAdBoards() {
const colors = [0xff0000, 0xffff00, 0x0000ff, 0x00ff00, 0xff00ff];
for (let x = -38; x <= 38; x += 12) {
const boardMat = new THREE.MeshBasicMaterial({ color: colors[Math.floor(Math.random()*colors.length)] });
const b1 = new THREE.Mesh(new THREE.BoxGeometry(10, 0.5, 0.3), boardMat); b1.position.set(x, 0.25, -53);
const b2 = new THREE.Mesh(new THREE.BoxGeometry(10, 0.5, 0.3), boardMat); b2.position.set(x, 0.25, 53);
scene.add(b1, b2);
}
}
function buildProfessionalStadium() {
const standMat = new THREE.MeshLambertMaterial({ color: 0x3d3d5c });
const roofMat = new THREE.MeshLambertMaterial({ color: 0x1f1f2e });
function addStandTier(width, depth, height, x, y, z) {
const stand = new THREE.Mesh(new THREE.BoxGeometry(width, height, depth), standMat);
stand.position.set(x, y, z);
scene.add(stand);
}
addStandTier(18, 120, 8, 48, 4, 0);
addStandTier(18, 120, 8, -48, 4, 0);
addStandTier(80, 18, 8, 0, 4, -62);
addStandTier(80, 25, 10, 0, 5, 62);
const roofLeft = new THREE.Mesh(new THREE.BoxGeometry(25, 2, 130), roofMat); roofLeft.position.set(-48, 20, 0);
const roofRight = new THREE.Mesh(new THREE.BoxGeometry(25, 2, 130), roofMat); roofRight.position.set(48, 20, 0);
scene.add(roofLeft, roofRight);
}
function buildMassiveHumanoidCrowd() {
const shirtColors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0xffffff, 0xff6600, 0x9900ff, 0x00ffff];
const skinTones = [0xffdbac, 0xf1c27d, 0xe0ac69, 0x8d5524];
for (let i = -52; i <= 52; i += 2.2) {
for (let row = 0; row < 4; row++) {
let xOffset = 42 + row * 2.2;
let yOffset = 2.0 + row * 2.2;
createAnatomicSpectator(-xOffset, yOffset, i, 'ATTACK_REACT', shirtColors[Math.floor(Math.random()*shirtColors.length)], skinTones[Math.floor(Math.random()*skinTones.length)]);
createAnatomicSpectator(xOffset, yOffset, i, 'ATTACK_REACT', shirtColors[Math.floor(Math.random()*shirtColors.length)], skinTones[Math.floor(Math.random()*skinTones.length)]);
}
}
}
function createAnatomicSpectator(x, y, z, type, shirtColor, skinColor) {
const group = new THREE.Group();
const skinMat = new THREE.MeshLambertMaterial({ color: skinColor });
const shirtMat = new THREE.MeshLambertMaterial({ color: shirtColor });
const pantsMat = new THREE.MeshLambertMaterial({ color: 0x111122 });
const head = new THREE.Mesh(new THREE.SphereGeometry(0.28, 6, 6), skinMat); head.position.y = 1.35; group.add(head);
const torso = new THREE.Mesh(new THREE.BoxGeometry(0.55, 0.65, 0.28), shirtMat); torso.position.y = 0.75; group.add(torso);
const legGeo = new THREE.BoxGeometry(0.18, 0.55, 0.18);
const legL = new THREE.Mesh(legGeo, pantsMat); legL.position.set(-0.14, 0.25, 0);
const legR = new THREE.Mesh(legGeo, pantsMat); legR.position.set(0.14, 0.25, 0);
group.add(legL, legR);
const armGeo = new THREE.BoxGeometry(0.14, 0.55, 0.14);
const armL = new THREE.Mesh(armGeo, shirtMat); armL.position.set(-0.35, 0.7, 0);
const armR = new THREE.Mesh(armGeo, shirtMat); armR.position.set(0.35, 0.7, 0);
group.add(armL, armR);
group.position.set(x, y, z);
scene.add(group);
crowdSpectators.push({ group: group, baseY: y, type: type, offset: Math.random() * Math.PI * 2 });
}
function buildCity3D() {
const bMat = new THREE.MeshLambertMaterial({ color: 0x111122 });
for (let i = 0; i < 20; i++) {
const h = 20 + Math.random() * 30, w = 12 + Math.random() * 15;
const b = new THREE.Mesh(new THREE.BoxGeometry(w, h, w), bMat);
const angle = Math.random() * Math.PI * 2, dist = 110 + Math.random() * 50;
b.position.set(Math.cos(angle)*dist, h/2, Math.sin(angle)*dist);
scene.add(b);
}
}
// --- FAN ZONE 3D ---
function initFanZone3D() {
const container = document.getElementById('fanzone-3d-container');
container.innerHTML = '';
fzScene = new THREE.Scene();
fzScene.background = new THREE.Color(0x020212);
fzCamera = new THREE.PerspectiveCamera(50, container.clientWidth / container.clientHeight, 0.1, 1000);
fzRenderer = new THREE.WebGLRenderer({ antialias: true });
fzRenderer.setSize(container.clientWidth, container.clientHeight);
container.appendChild(fzRenderer.domElement);
fzScene.add(new THREE.AmbientLight(0xffffff, 0.7));
const dLight = new THREE.DirectionalLight(0xffffff, 0.9);
dLight.position.set(20, 50, 20);
fzScene.add(dLight);
const plazaMat = new THREE.MeshLambertMaterial({ color: 0x1b1b2f });
const plaza = new THREE.Mesh(new THREE.PlaneGeometry(140, 140), plazaMat);
plaza.rotation.x = -Math.PI / 2;
fzScene.add(plaza);
const monumentMat = new THREE.MeshLambertMaterial({ color: 0xcccccc });
const monumentBase = new THREE.Mesh(new THREE.BoxGeometry(6, 15, 6), monumentMat);
monumentBase.position.set(0, 7.5, -25);
fzScene.add(monumentBase);
const monumentTop = new THREE.Mesh(new THREE.ConeGeometry(5, 10, 4), new THREE.MeshLambertMaterial({ color: 0xffd700 }));
monumentTop.position.set(0, 20, -25);
fzScene.add(monumentTop);
fzSpectators = [];
fzFireworks = [];
const skinTones = [0xffdbac, 0xf1c27d, 0xe0ac69, 0x8d5524];
const shirtColors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0xffffff, 0xff6600];
for (let x = -16; x <= 16; x += 2.0) {
for (let z = -6; z <= 10; z += 2.0) {
const group = new THREE.Group();
const skinMat = new THREE.MeshLambertMaterial({ color: skinTones[Math.floor(Math.random()*skinTones.length)] });
const shirtMat = new THREE.MeshLambertMaterial({ color: shirtColors[Math.floor(Math.random()*shirtColors.length)] });
const head = new THREE.Mesh(new THREE.SphereGeometry(0.25, 6, 6), skinMat); head.position.y = 1.2;
const torso = new THREE.Mesh(new THREE.BoxGeometry(0.5, 0.6, 0.25), shirtMat); torso.position.y = 0.6;
group.add(head, torso);
group.position.set(x, 0, z);
fzScene.add(group);
fzSpectators.push({ group: group, baseY: 0, offset: Math.random() * Math.PI * 2 });
}
}
}
function updateFanZone3D() {
if (!fzRenderer) return;
const time = Date.now() * 0.005;
fzSpectators.forEach(s => {
s.group.position.y = Math.abs(Math.sin(time * 6 + s.offset)) * 0.45;
});
if (Math.random() < 0.1) {
const fwGeo = new THREE.BufferGeometry();
const pCount = 18, pos = new Float32Array(pCount * 3), vels = [];
const sX = (Math.random()-0.5)*30, sY = 15 + Math.random()*15, sZ = -10 + (Math.random()-0.5)*20;
for (let p = 0; p < pCount; p++) {
pos[p*3] = sX; pos[p*3+1] = sY; pos[p*3+2] = sZ;
vels.push(new THREE.Vector3((Math.random()-0.5)*0.35, (Math.random()-0.5)*0.35, (Math.random()-0.5)*0.35));
}
fwGeo.setAttribute('position', new THREE.BufferAttribute(pos, 3));
const fw = new THREE.Points(fwGeo, new THREE.PointsMaterial({ color: new THREE.Color().setHSL(Math.random(),1,0.6), size: 1.2 }));
fzScene.add(fw);
fzFireworks.push({ system: fw, vels: vels, life: 30 });
}
for (let i = fzFireworks.length - 1; i >= 0; i--) {
const fw = fzFireworks[i]; fw.life--;
const pos = fw.system.geometry.attributes.position.array;
for (let p = 0; p < fw.vels.length; p++) {
pos[p*3] += fw.vels[p].x; pos[p*3+1] += fw.vels[p].y; pos[p*3+2] += fw.vels[p].z;
}
fw.system.geometry.attributes.position.needsUpdate = true;
if (fw.life <= 0) { fzScene.remove(fw.system); fzFireworks.splice(i, 1); }
}
fzCamera.position.x = Math.sin(time * 0.3) * 35;
fzCamera.position.y = 14;
fzCamera.position.z = Math.cos(time * 0.3) * 35;
fzCamera.lookAt(0, 8, -10);
fzRenderer.render(fzScene, fzCamera);
}
function launchFireworks(count) {
for (let i = 0; i < Math.min(count, 3); i++) {
const fwGeo = new THREE.BufferGeometry();
const pCount = 15, pos = new Float32Array(pCount * 3), vels = [];
const sX = (Math.random()-0.5)*50, sY = 22 + Math.random()*20, sZ = 40 + (Math.random()-0.5)*20;
for (let p = 0; p < pCount; p++) {
pos[p*3] = sX; pos[p*3+1] = sY; pos[p*3+2] = sZ;
vels.push(new THREE.Vector3((Math.random()-0.5)*0.4, (Math.random()-0.5)*0.4, (Math.random()-0.5)*0.4));
}
fwGeo.setAttribute('position', new THREE.BufferAttribute(pos, 3));
const fw = new THREE.Points(fwGeo, new THREE.PointsMaterial({ color: new THREE.Color().setHSL(Math.random(),1,0.6), size: 1.0 }));
scene.add(fw);
fireworks.push({ system: fw, vels: vels, life: 35 });
}
}
function updateFireworks() {
for (let i = fireworks.length - 1; i >= 0; i--) {
const fw = fireworks[i]; fw.life--;
const pos = fw.system.geometry.attributes.position.array;
for (let p = 0; p < fw.vels.length; p++) {
pos[p*3] += fw.vels[p].x; pos[p*3+1] += fw.vels[p].y; pos[p*3+2] += fw.vels[p].z;
}
fw.system.geometry.attributes.position.needsUpdate = true;
if (fw.life <= 0) { scene.remove(fw.system); fireworks.splice(i, 1); }
}
}
// --- SEQUÊNCIA DE LEVANTAR A TAÇA NA FINAL ---
function triggerTrophyLiftSequence(isHomeWinner) {
gameState = 'TROPHY_LIFT';
goalTimer = 0;
document.getElementById('cam-status').style.display = 'block';
document.getElementById('cam-status').innerText = `🏆 ${isHomeWinner ? playerData.homeTeam : playerData.awayTeam} É O CAMPEÃO DA ${playerData.champName}!`;
if (trophyGroup) scene.remove(trophyGroup);
trophyGroup = new THREE.Group();
const goldMat = new THREE.MeshLambertMaterial({ color: 0xffd700, emissive: 0x332200 });
const cupBase = new THREE.Mesh(new THREE.CylinderGeometry(0.8, 1.2, 1.0, 16), goldMat);
cupBase.position.y = 0.5;
const cupStem = new THREE.Mesh(new THREE.CylinderGeometry(0.3, 0.3, 2.0, 16), goldMat);
cupStem.position.y = 2.0;
const cupBowl = new THREE.Mesh(new THREE.SphereGeometry(1.2, 16, 16), goldMat);
cupBowl.position.y = 3.5;
trophyGroup.add(cupBase, cupStem, cupBowl);
trophyGroup.position.set(0, 0, 10);
scene.add(trophyGroup);
launchFireworks(8);
setTimeout(() => {
alert(`FIM DO CAMPEONATO!\n🏆 Campeão: ${isHomeWinner ? playerData.homeTeam : playerData.awayTeam}\nParabéns pela conquista da taça personalizada!`);
location.reload();
}, 6000);
}
// --- GAME LOOP ---
function gameLoop() {
requestAnimationFrame(gameLoop);
const time = Date.now() * 0.003;
const isAttacking = ball.position.z < -10;
crowdSpectators.forEach(s => {
if (s.type === 'ATTACK_REACT') {
const targetY = isAttacking ? s.baseY + 0.4 : s.baseY;
s.group.position.y += (targetY - s.group.position.y) * 0.1;
}
});
updateFireworks();
if (gameState === 'INTRO') {
introTimer++;
camera.position.x = Math.sin(introTimer * 0.015) * 110;
camera.position.y = 50 + Math.sin(introTimer * 0.02) * 10;
camera.position.z = Math.cos(introTimer * 0.015) * 110;
camera.lookAt(0, 0, 0);
document.getElementById('cam-status').style.display = 'block';
document.getElementById('cam-status').innerText = '🎥 CÂMERA: HELICÓPTERO (AÉREA)';
if (introTimer > 120) {
gameState = 'PLAYING';
document.getElementById('cam-status').style.display = 'none';
}
} else if (gameState === 'PLAYING') {
const speed = 0.22 + (playerData.pac / 100) * 0.2;
let p1Up = keys['KeyW'] || touchKeys['KeyW'];
let p1Down = keys['KeyS'] || touchKeys['KeyS'];
let p1Left = keys['KeyA'] || touchKeys['KeyA'];
let p1Right = keys['KeyD'] || touchKeys['KeyD'];
let p1Kick = keys['Space'] || touchKeys['Space'];
if (p1Up) playerObj.position.z -= speed;
if (p1Down) playerObj.position.z += speed;
if (p1Left) playerObj.position.x -= speed;
if (p1Right) playerObj.position.x += speed;
playerObj.position.x = Math.max(-38, Math.min(38, playerObj.position.x));
playerObj.position.z = Math.max(-48, Math.min(48, playerObj.position.z));
homeGk.position.x += (ball.position.x * 0.4 - homeGk.position.x) * 0.08;
homeGk.position.x = Math.max(-5, Math.min(5, homeGk.position.x));
awayGk.position.x += (ball.position.x * 0.4 - awayGk.position.x) * 0.08;
awayGk.position.x = Math.max(-5, Math.min(5, awayGk.position.x));
if (homeGk.position.distanceTo(ball.position) < 2.0) ball.velocity.z = 0.6;
if (awayGk.position.distanceTo(ball.position) < 2.0) ball.velocity.z = -0.6;
if (playerData.mode === 'multi') {
let p2Up = keys['ArrowUp'];
let p2Down = keys['ArrowDown'];
let p2Left = keys['ArrowLeft'];
let p2Right = keys['ArrowRight'];
let p2Kick = keys['Enter'] || keys['ShiftRight'];
if (p2Up) p2Obj.position.z -= speed;
if (p2Down) p2Obj.position.z += speed;
if (p2Left) p2Obj.position.x -= speed;
if (p2Right) p2Obj.position.x += speed;
p2Obj.position.x = Math.max(-38, Math.min(38, p2Obj.position.x));
p2Obj.position.z = Math.max(-48, Math.min(48, p2Obj.position.z));
if (p2Obj.position.distanceTo(ball.position) < 2.0) {
const dirX = ball.position.x - p2Obj.position.x;
const dirZ = ball.position.z - p2Obj.position.z;
ball.velocity.x += dirX * 0.05; ball.velocity.z += dirZ * 0.05;
if (p2Kick) {
ball.velocity.z = 0.8; ball.velocity.y = 0.35;
ball.velocity.x += (Math.random() - 0.5) * 0.2;
}
}
} else {
if (ball.position.z < -10) {
const targetX = Math.max(-4, Math.min(4, ball.position.x));
p2Obj.position.x += (targetX - p2Obj.position.x) * 0.03;
}
if (p2Obj.position.distanceTo(ball.position) < 1.8) {
ball.velocity.z = 0.7; ball.velocity.y = 0.2;
}
}
ball.position.add(ball.velocity);
ball.velocity.multiplyScalar(0.97);
if (ball.position.y > 0.8) ball.velocity.y -= 0.02;
else { ball.position.y = 0.8; ball.velocity.y = 0; }
if (playerObj.position.distanceTo(ball.position) < 2.0) {
const dirX = ball.position.x - playerObj.position.x;
const dirZ = ball.position.z - playerObj.position.z;
ball.velocity.x += dirX * 0.05; ball.velocity.z += dirZ * 0.05;
if (p1Kick) {
const power = 0.8 + (playerData.sho / 100) * 0.8;
ball.velocity.z = -power; ball.velocity.y = 0.35;
ball.velocity.x += (Math.random() - 0.5) * 0.2;
}
}
if (ball.position.x > 39 || ball.position.x < -39) ball.velocity.x *= -1;
if (ball.position.z > 52) {
awayScore++;
document.getElementById('hud-score').innerText = `${homeScore} - ${awayScore}`;
resetBallAndPlayers();
}
if (ball.position.z < -50 && Math.abs(ball.position.x) < 6 && ball.position.y < 6) {
triggerGoalSequence();
}
camera.position.x += (ball.position.x - camera.position.x) * 0.05;
camera.position.z = ball.position.z + 38;
camera.position.y = 28;
camera.lookAt(ball.position);
} else if (gameState === 'GOAL_SPLIT_FANZONE') {
goalTimer++;
launchFireworks(1);
updateFanZone3D();
if (goalTimer > 180) {
document.getElementById('split-screen-container').style.display = 'none';
triggerWipeTransition(() => {
gameState = 'GOAL_REPLAY';
goalTimer = 0;
});
}
} else if (gameState === 'GOAL_REPLAY') {
// REPLAY DINÂMICO COM CÂMERA ORBITAL FLUIDA
goalTimer++;
const orbitAngle = goalTimer * 0.025;
camera.position.x = ball.position.x + Math.sin(orbitAngle) * 22;
camera.position.y = 6 + Math.sin(goalTimer * 0.03) * 4;
camera.position.z = ball.position.z + Math.cos(orbitAngle) * 22;
camera.lookAt(ball.position);
if (goalTimer === 1) {
document.getElementById('cam-status').style.display = 'block';
document.getElementById('cam-status').innerText = '🎥 REPLAY DINÂMICO DO LANCE';
}
if (goalTimer > 160) {
document.getElementById('cam-status').style.display = 'none';
triggerWipeTransition(() => {
gameState = 'PLAYING';
resetBallAndPlayers();
});
}
} else if (gameState === 'TROPHY_LIFT') {
goalTimer++;
const angle = goalTimer * 0.02;
camera.position.x = Math.sin(angle) * 15;
camera.position.y = 4 + Math.sin(goalTimer * 0.05) * 1.5;
camera.position.z = 10 + Math.cos(angle) * 15;
camera.lookAt(0, 2, 10);
if (trophyGroup) {
trophyGroup.rotation.y += 0.03;
trophyGroup.position.y = 0.5 + Math.abs(Math.sin(goalTimer * 0.08)) * 1.5;
}
}
renderer.render(scene, camera);
}
function triggerWipeTransition(callback) {
const wipe = document.getElementById('replay-wipe');
wipe.classList.remove('active');
void wipe.offsetWidth;
wipe.classList.add('active');
setTimeout(() => {
if (callback) callback();
}, 700);
}
function resetBallAndPlayers() {
ball.position.set(0, 0.8, 0); ball.velocity.set(0,0,0);
playerObj.position.set(0, 1.5, 20);
p2Obj.position.set(0, 1.5, -20);
homeGk.position.set(0, 1.4, 48);
awayGk.position.set(0, 1.4, -48);
}
function triggerGoalSequence() {
if (gameState === 'GOAL_SPLIT_FANZONE' || gameState === 'GOAL_REPLAY' || gameState === 'TROPHY_LIFT') return;
gameState = 'GOAL_SPLIT_FANZONE';
goalTimer = 0;
homeScore++;
document.getElementById('hud-score').innerText = `${homeScore} - ${awayScore}`;
playerData.xp += 30;
updateCard();
const chosenZone = globalFanZones[Math.floor(Math.random() * globalFanZones.length)];
document.getElementById('fanzone-city-title').innerText = `📍 FAN ZONE 3D - ${chosenZone.name.split(' - ')[0]}`;
document.getElementById('fanzone-city-name').innerText = chosenZone.name;
document.getElementById('fanzone-desc').innerText = chosenZone.desc;
document.getElementById('stadium-goal-text').innerText = `GOL HISTÓRICO DE ${playerData.name}!`;
document.getElementById('split-screen-container').style.display = 'grid';
initFanZone3D();
triggerWipeTransition();
launchFireworks(4);
}
updateCard();
</script>
</body>
</html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Futebol 3D V16 - Campeonato Personalizado, Upload Local, Replay Dinâmico & Mobile Pro</title>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
user-select: none;
-webkit-user-select: none;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
touch-action: manipulation;
}
body {
width: 100vw;
height: 100vh;
overflow: hidden;
background-color: #03030a;
color: white;
}
#game-canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
}
/* MENU PRINCIPAL & EDIÇÃO MOBILE */
#menu-screen {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: radial-gradient(circle, rgba(10,20,40,0.96) 0%, rgba(2,3,8,0.99) 100%);
z-index: 100;
display: flex;
align-items: center;
justify-content: center;
gap: 25px;
overflow-y: auto;
padding: 15px;
}
.menu-panel {
background: rgba(255, 255, 255, 0.05);
padding: 18px;
border-radius: 14px;
border: 1px solid rgba(0, 255, 204, 0.2);
width: 440px;
max-width: 100%;
box-shadow: 0 10px 35px rgba(0,0,0,0.85);
backdrop-filter: blur(12px);
max-height: 96vh;
overflow-y: auto;
}
.menu-panel h1 {
text-align: center;
color: #00ffcc;
margin-bottom: 10px;
font-size: 1.5rem;
text-shadow: 0 0 12px rgba(0,255,204,0.6);
}
.mobile-edition-badge {
background: linear-gradient(135deg, #00ffcc, #0088ff);
color: #000;
font-weight: 900;
font-size: 0.75rem;
text-align: center;
padding: 4px;
border-radius: 6px;
margin-bottom: 12px;
text-transform: uppercase;
box-shadow: 0 0 10px rgba(0,255,204,0.4);
}
.form-group { margin-bottom: 8px; }
.form-group label { display: block; font-size: 0.78rem; color: #aaa; margin-bottom: 2px; }
.form-group input, .form-group select, .form-group textarea {
width: 100%;
padding: 7px 10px;
border-radius: 6px;
border: 1px solid #444;
background: #1a1a24;
color: #fff;
font-size: 0.85rem;
font-weight: bold;
}
.file-upload-box {
background: rgba(0, 255, 204, 0.05);