|
8 | 8 | <script src="https://unpkg.com/peerjs@1.5.4/dist/peerjs.min.js"></script> |
9 | 9 | <script src="https://www.gstatic.com/firebasejs/9.23.0/firebase-app-compat.js"></script> |
10 | 10 | <script src="https://www.gstatic.com/firebasejs/9.23.0/firebase-database-compat.js"></script> |
11 | | - |
| 11 | + |
12 | 12 | <style> |
13 | 13 | :root { |
14 | 14 | --neon-cyan: #00ffff; |
|
25 | 25 | -webkit-background-clip: text; -webkit-text-fill-color: transparent; |
26 | 26 | margin-bottom: 1rem; text-transform: uppercase; letter-spacing: 2px; |
27 | 27 | } |
28 | | - |
| 28 | + |
29 | 29 | #lobbyPanel { |
30 | 30 | max-width: 500px; margin: 10px auto; border: 1px solid var(--neon-cyan); |
31 | 31 | background: rgba(0, 255, 255, 0.05); border-radius: 8px; padding: 15px; |
|
47 | 47 | padding: 0.8rem 1.5rem; font-size: 1.1rem; font-weight: bold; cursor: pointer; transition: 0.3s; width: 180px; |
48 | 48 | } |
49 | 49 | .mode-btn.active-mode { border-color: var(--neon-cyan); color: #000; background: var(--neon-cyan); box-shadow: 0 0 20px var(--neon-cyan); } |
50 | | - |
| 50 | + |
51 | 51 | .scoreboard { display: flex; justify-content: center; gap: 2rem; margin-bottom: 1rem; font-size: 1.2rem; } |
52 | 52 | .score-box { background: var(--glass); border: 1px solid #333; padding: 0.5rem 1.5rem; border-radius: 4px; min-width: 130px; text-align: center; transition: 0.3s; } |
53 | 53 | .score-box.active { border-color: currentColor; box-shadow: 0 0 15px currentColor; background: rgba(255,255,255,0.1); } |
54 | 54 | .score-white { color: #fff; } |
55 | 55 | .score-black { color: var(--neon-magenta); } |
56 | | - |
| 56 | + |
57 | 57 | .status-display { text-align: center; font-size: 1.1rem; color: #888; min-height: 1.5em; margin-bottom: 10px; } |
58 | 58 | .status-display.alert { color: var(--alert-red); animation: textPulse 1s infinite; } |
59 | 59 | @keyframes textPulse { 0%{opacity:1} 50%{opacity:0.7} 100%{opacity:1} } |
|
64 | 64 | border: 4px solid var(--neon-cyan); background: #000; transform: rotateX(5deg); transition: 0.3s; |
65 | 65 | } |
66 | 66 | .chessboard.danger-state { border-color: var(--alert-red); box-shadow: 0 0 30px rgba(255,0,0,0.3); } |
67 | | - |
| 67 | + |
68 | 68 | .square { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; } |
69 | 69 | .square.light { background: #2a2a2a; } |
70 | 70 | .square.dark { background: #1a1a1a; } |
71 | 71 | .square.valid-move::after { content: ''; position: absolute; width: 15px; height: 15px; background: rgba(0, 255, 0, 0.4); border-radius: 50%; box-shadow: 0 0 10px #0f0; } |
72 | 72 | .square.capture-move::after { content: ''; position: absolute; width: 100%; height: 100%; background: rgba(255, 0, 0, 0.3); box-shadow: inset 0 0 15px #f00; } |
73 | 73 | .square.selected { background: rgba(0, 255, 255, 0.2) !important; box-shadow: inset 0 0 15px var(--neon-cyan); } |
74 | | - |
| 74 | + |
75 | 75 | .piece { font-size: clamp(2rem, 9vw, 3.5rem); user-select: none; z-index: 2; transition: transform 0.2s; } |
76 | 76 | .piece.white { color: #e0e0e0; text-shadow: 0 0 10px rgba(255,255,255,0.5); } |
77 | 77 | .piece.black { color: #ff00ff; text-shadow: 0 0 10px rgba(255,0,255,0.5); } |
78 | | - |
| 78 | + |
79 | 79 | .cyber-btn { background: rgba(0, 0, 0, 0.5); border: 1px solid var(--neon-cyan); color: var(--neon-cyan); padding: 0.5rem 1.5rem; text-transform: uppercase; cursor: pointer; transition: 0.3s; margin: 0 5px; font-weight: bold; } |
80 | 80 | .cyber-btn:hover { background: var(--neon-cyan); color: #000; box-shadow: 0 0 15px var(--neon-cyan); } |
81 | | - |
| 81 | + |
82 | 82 | #chatToggle { position: fixed; bottom: 20px; right: 20px; z-index: 1000; border-radius: 50%; width: 50px; height: 50px; } |
83 | 83 | #chatPanel { position: fixed; top: 0; right: -320px; width: 320px; height: 100vh; background: rgba(10, 10, 10, 0.98); border-left: 2px solid var(--neon-cyan); z-index: 999; transition: 0.4s; display: flex; flex-direction: column; padding: 15px; } |
84 | 84 | #chatPanel.open { right: 0; } |
|
92 | 92 | <section id="cyberChessSection"> |
93 | 93 | <div class="container"> |
94 | 94 | <h2 class="chess-title">Cyber Chess v12</h2> |
95 | | - |
| 95 | + |
96 | 96 | <div id="lobbyPanel"> |
97 | 97 | <div class="d-flex justify-content-between align-items-center"> |
98 | 98 | <small id="status" class="text-info">Connecting to Matrix...</small> |
@@ -140,7 +140,7 @@ <h5 class="text-info">SECURE CHAT</h5> |
140 | 140 | const firebaseConfig = { databaseURL: "https://cyber-chess-lobby-default-rtdb.firebaseio.com" }; |
141 | 141 | firebase.initializeApp(firebaseConfig); |
142 | 142 | const db = firebase.database(); |
143 | | - |
| 143 | + |
144 | 144 | const lobby = { |
145 | 145 | updateList(snapshot) { |
146 | 146 | const listEl = document.getElementById('lobbyList'); |
@@ -234,7 +234,7 @@ <h5 class="text-info">SECURE CHAT</h5> |
234 | 234 | this.render(); this.updateUI(); |
235 | 235 | }, |
236 | 236 | setMode(m) { this.mode = m; document.getElementById('btnPvP').classList.toggle('active-mode', m==='pvp'); document.getElementById('btnAI').classList.toggle('active-mode', m==='ai'); this.init(); }, |
237 | | - |
| 237 | + |
238 | 238 | evaluateBoard(b) { |
239 | 239 | let total = 0; |
240 | 240 | for(let r=0; r<8; r++) for(let c=0; c<8; c++) { |
@@ -308,7 +308,7 @@ <h5 class="text-info">SECURE CHAT</h5> |
308 | 308 | const type = p.toLowerCase(); const dx = t.c-f.c, dy = t.r-f.r; |
309 | 309 | const target = this.board[t.r][t.c]; |
310 | 310 | if(target && (p===p.toLowerCase()) === (target===target.toLowerCase())) return false; |
311 | | - |
| 311 | + |
312 | 312 | let geo = false; |
313 | 313 | if(type==='p') { |
314 | 314 | const dir = p==='p'?-1:1; |
|
0 commit comments