Files
kaltaquise-gamification/sys_digger/index.html
2026-04-21 10:38:04 +02:00

417 lines
13 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sys Digger</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background: #0a0a1a;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
font-family: 'Courier New', monospace;
overflow: hidden;
}
canvas { display: block; cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><g transform='translate(16,16) rotate(-45)'><path d='M 0 -5 L -6 -5 A 5 5 0 0 0 -6 5 L 0 5 Z' fill='%23ff4444'/><path d='M 0 -5 L 6 -5 A 5 5 0 0 1 6 5 L 0 5 Z' fill='%23f5f5f5'/><path d='M -6 -5 L 6 -5 A 5 5 0 0 1 6 5 L -6 5 A 5 5 0 0 0 -6 -5 Z' fill='none' stroke='%23222222' stroke-width='1.2'/><line x1='0' y1='-5' x2='0' y2='5' stroke='%23555555' stroke-width='0.8'/></g></svg>") 16 16, auto; }
#score {
position: absolute;
top: 20px;
right: 20px;
color: #00ff88;
font-size: 24px;
text-shadow: 0 0 10px #00ff88;
}
#highscore {
position: absolute;
top: 52px;
right: 20px;
color: #ffcc00;
font-size: 16px;
text-shadow: 0 0 8px #ffcc00;
}
#cystinstein-area {
position: absolute;
top: 20px;
left: 20px;
width: 160px;
border: 2px solid #ff4444;
border-radius: 8px;
padding: 10px;
background: rgba(0, 0, 0, 0.75);
}
#cystinstein-label {
color: #ff4444;
font-size: 11px;
text-align: center;
letter-spacing: 2px;
margin-bottom: 6px;
text-shadow: 0 0 8px #ff4444;
}
#cystinstein-canvas { display: block; margin: 0 auto; }
#docks-count {
color: #ff8888;
font-size: 11px;
text-align: center;
margin-top: 6px;
}
/* ── Intro screen ── */
#intro {
display: flex;
position: absolute;
top: 0; left: 0;
width: 100%; height: 100%;
background: rgba(0, 0, 0, 0.92);
justify-content: center;
align-items: center;
flex-direction: column;
color: white;
text-align: center;
padding: 40px 20px;
z-index: 10;
}
#intro.hidden { display: none; }
#intro h1 {
font-size: 64px;
letter-spacing: 8px;
color: #00ff88;
text-shadow: 0 0 30px #00ff88, 0 0 60px #00ff8855;
margin-bottom: 6px;
animation: flicker 2s infinite alternate;
}
#intro .subtitle {
font-size: 15px;
letter-spacing: 4px;
color: #00ccff;
text-shadow: 0 0 10px #00ccff;
margin-bottom: 40px;
text-transform: uppercase;
}
#intro .instructions {
max-width: 480px;
margin-bottom: 40px;
display: flex;
flex-direction: column;
gap: 14px;
}
#intro .instruction-row {
display: flex;
align-items: center;
gap: 16px;
background: rgba(255,255,255,0.04);
border: 1px solid rgba(255,255,255,0.08);
border-radius: 8px;
padding: 12px 18px;
text-align: left;
}
#intro .instruction-icon {
font-size: 26px;
flex-shrink: 0;
width: 36px;
text-align: center;
}
#intro .instruction-text {
font-size: 13px;
color: #aaa;
line-height: 1.5;
}
#intro .instruction-text strong { color: #fff; }
#start-btn {
padding: 16px 52px;
font-size: 20px;
font-family: 'Courier New', monospace;
font-weight: bold;
background: #00ff88;
color: #000;
border: none;
border-radius: 8px;
cursor: pointer;
letter-spacing: 2px;
transition: background 0.2s, transform 0.1s;
}
#start-btn:hover { background: #00cc66; transform: scale(1.04); }
/* ── Attract / highscore screen ── */
#attract {
display: flex;
position: absolute;
top: 0; left: 0;
width: 100%; height: 100%;
background: rgba(0, 0, 0, 0.92);
justify-content: center;
align-items: center;
flex-direction: column;
color: white;
text-align: center;
padding: 40px 20px;
z-index: 10;
}
#attract.hidden { display: none; }
#attract h2 {
font-size: 13px;
letter-spacing: 5px;
color: #ffcc00;
text-shadow: 0 0 12px #ffcc00;
margin-bottom: 6px;
}
#attract .attract-game-title {
font-size: 44px;
letter-spacing: 6px;
color: #00ff88;
text-shadow: 0 0 20px #00ff88;
margin-bottom: 32px;
animation: flicker 2s infinite alternate;
}
#attract-table {
width: 360px;
border-collapse: collapse;
font-size: 16px;
margin-bottom: 36px;
}
#attract-table th {
color: #555;
font-size: 11px;
letter-spacing: 1px;
padding: 4px 10px;
border-bottom: 1px solid #333;
}
#attract-table td { padding: 8px 10px; color: #ccc; border-bottom: 1px solid #1a1a2e; }
#attract-table tr.rank-1 td { color: #ffd700; font-size: 18px; }
#attract-table tr.rank-2 td { color: #c0c0c0; }
#attract-table tr.rank-3 td { color: #cd7f32; }
.attract-hint {
font-size: 13px;
color: #444;
letter-spacing: 2px;
animation: flicker 1.2s infinite alternate;
}
/* ── Game-over overlay ── */
#overlay {
display: none;
position: absolute;
top: 0; left: 0;
width: 100%; height: 100%;
background: rgba(0, 0, 0, 0.90);
justify-content: center;
align-items: center;
flex-direction: column;
color: white;
text-align: center;
overflow-y: auto;
padding: 30px 20px;
}
#overlay.active { display: flex; }
#overlay h1 {
font-size: 44px;
color: #ff4444;
margin-bottom: 6px;
text-shadow: 0 0 30px #ff4444;
animation: flicker 1s infinite alternate;
}
@keyframes flicker {
from { opacity: 1; }
to { opacity: 0.75; }
}
#final-score {
font-size: 26px;
color: #00ff88;
text-shadow: 0 0 8px #00ff88;
margin-bottom: 4px;
}
#new-record {
font-size: 18px;
color: #ffcc00;
text-shadow: 0 0 12px #ffcc00;
margin-bottom: 16px;
animation: flicker 0.6s infinite alternate;
display: none;
}
#new-record.visible { display: block; }
/* ── Name form ── */
#name-form {
display: flex;
gap: 8px;
margin-bottom: 24px;
}
#player-name {
padding: 10px 14px;
font-size: 16px;
font-family: 'Courier New', monospace;
background: #111;
color: #fff;
border: 2px solid #00ff88;
border-radius: 6px;
outline: none;
width: 200px;
}
#player-name:focus { border-color: #00ffcc; }
#submit-score-btn {
padding: 10px 20px;
font-size: 16px;
font-family: 'Courier New', monospace;
font-weight: bold;
background: #00ff88;
color: #000;
border: none;
border-radius: 6px;
cursor: pointer;
transition: background 0.2s;
}
#submit-score-btn:hover { background: #00cc66; }
/* ── Leaderboard ── */
#leaderboard {
width: 340px;
margin-bottom: 24px;
}
#leaderboard h2 {
font-size: 13px;
letter-spacing: 3px;
color: #ffcc00;
text-shadow: 0 0 8px #ffcc00;
margin-bottom: 10px;
}
#leaderboard table {
width: 100%;
border-collapse: collapse;
font-size: 15px;
}
#leaderboard th {
color: #888;
font-size: 11px;
letter-spacing: 1px;
padding: 4px 8px;
border-bottom: 1px solid #333;
}
#leaderboard td {
padding: 6px 8px;
color: #ccc;
border-bottom: 1px solid #1a1a2e;
}
#leaderboard tr.rank-1 td { color: #ffd700; }
#leaderboard tr.rank-2 td { color: #c0c0c0; }
#leaderboard tr.rank-3 td { color: #cd7f32; }
#leaderboard tr.highlight td {
color: #00ff88;
text-shadow: 0 0 6px #00ff88;
background: rgba(0, 255, 136, 0.06);
}
.rank-num { width: 32px; text-align: center; color: #555; }
#restart-btn {
padding: 14px 40px;
background: #00ff88;
color: #000;
border: none;
border-radius: 8px;
font-size: 20px;
font-family: 'Courier New', monospace;
font-weight: bold;
cursor: pointer;
transition: background 0.2s;
}
#restart-btn:hover { background: #00cc66; }
</style>
</head>
<body>
<canvas id="gameCanvas"></canvas>
<div id="cystinstein-area">
<div id="cystinstein-label">CYSTINSTEIN</div>
<canvas id="cystinstein-canvas" width="130" height="130"></canvas>
<div id="docks-count">0 / 6 docks</div>
</div>
<div id="score">Score: 0</div>
<div id="highscore">Best: —</div>
<div id="intro">
<h1>SYS DIGGER</h1>
<div class="subtitle">Protect the atom</div>
<div class="instructions">
<div class="instruction-row">
<div class="instruction-icon"></div>
<div class="instruction-text">
A molecule sits at the center of the screen with <strong>anchor points</strong> around it.
</div>
</div>
<div class="instruction-row">
<div class="instruction-icon">💊</div>
<div class="instruction-text">
<strong>Click the glowing red anchor</strong> when an atom approaches to block the connection.
</div>
</div>
<div class="instruction-row">
<div class="instruction-icon">🧫</div>
<div class="instruction-text">
Each missed dock grows the <strong>Cystinstein</strong> in the top-left.
Allow <strong>${MAX_DOCKS} docks</strong> and it's fully formed — game over.
</div>
</div>
</div>
<button id="start-btn" onclick="startGame()">START</button>
</div>
<div id="attract" class="hidden">
<h2>HIGH SCORES</h2>
<div class="attract-game-title">SYS DIGGER</div>
<table id="attract-table">
<thead>
<tr>
<th class="rank-num">#</th>
<th style="text-align:left">Name</th>
<th style="text-align:right">Score</th>
</tr>
</thead>
<tbody id="attract-rows"></tbody>
</table>
<div class="attract-hint">— Press any key to continue —</div>
</div>
<div id="overlay">
<h1>CYSTINSTEIN FORMED!</h1>
<p id="final-score"></p>
<p id="new-record">&#9733; NEW HIGH SCORE &#9733;</p>
<div id="name-form">
<input id="player-name" type="text" maxlength="20" placeholder="Your name" autocomplete="off" />
<button id="submit-score-btn" onclick="submitScore()">Save</button>
</div>
<div id="leaderboard">
<h2>LEADERBOARD</h2>
<table>
<thead>
<tr>
<th class="rank-num">#</th>
<th style="text-align:left">Name</th>
<th style="text-align:right">Score</th>
</tr>
</thead>
<tbody id="leaderboard-rows"></tbody>
</table>
</div>
<button id="restart-btn" onclick="restartGame()">Play Again</button>
</div>
<script src="constants.js"></script>
<script src="atom.js"></script>
<script src="render.js"></script>
<script src="game.js"></script>
</body>
</html>