605 行
19 KiB
HTML
605 行
19 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>CSP Learning Platform - Minecraft Login</title>
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/remixicon/4.6.0/remixicon.min.css" rel="stylesheet">
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
|
|
|
|
<style>
|
|
:root {
|
|
--mc-dirt-side: #79553a;
|
|
--mc-dirt-top: #5c3f2b;
|
|
--mc-grass-top: #70b348;
|
|
--mc-grass-side: #5a9139;
|
|
--mc-stone: #7d7d7d;
|
|
--mc-wood: #a0744b;
|
|
--mc-wood-dark: #6e4e34;
|
|
--mc-wood-light: #bca07e;
|
|
--mc-diamond: #29B6F6;
|
|
--mc-redstone: #E53935;
|
|
--mc-gold: #FFD700;
|
|
--mc-sky: #cceeff;
|
|
--bg-sky-top: #87CEEB;
|
|
--bg-sky-bottom: #E0F7FA;
|
|
}
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
margin: 0;
|
|
padding: 0;
|
|
font-family: 'Press Start 2P', cursive;
|
|
}
|
|
|
|
body {
|
|
width: 1920px;
|
|
min-height: 1080px;
|
|
background: linear-gradient(to bottom, var(--bg-sky-top), var(--bg-sky-bottom));
|
|
overflow-x: hidden;
|
|
position: relative;
|
|
color: white;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
}
|
|
|
|
/* Pixel Cloud Background Decoration */
|
|
.clouds {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
z-index: -1;
|
|
pointer-events: none;
|
|
background-image:
|
|
radial-gradient(circle at 15% 20%, white 20px, transparent 21px),
|
|
radial-gradient(circle at 85% 30%, white 30px, transparent 31px),
|
|
radial-gradient(circle at 50% 10%, rgba(255,255,255,0.8) 40px, transparent 41px);
|
|
background-size: 800px 400px;
|
|
opacity: 0.6;
|
|
}
|
|
|
|
/* Top Nav */
|
|
.navbar {
|
|
width: 100%;
|
|
height: 80px;
|
|
background-color: rgba(0, 0, 0, 0.4);
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0 40px;
|
|
border-bottom: 4px solid rgba(0, 0, 0, 0.2);
|
|
backdrop-filter: blur(4px);
|
|
position: fixed;
|
|
top: 0;
|
|
z-index: 100;
|
|
}
|
|
|
|
.logo {
|
|
font-size: 20px;
|
|
color: #fff;
|
|
text-shadow: 4px 4px 0px #000;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 16px;
|
|
}
|
|
|
|
.logo i {
|
|
color: var(--mc-grass-top);
|
|
font-size: 28px;
|
|
}
|
|
|
|
/* Main Container */
|
|
.main-container {
|
|
margin-top: 140px;
|
|
position: relative;
|
|
z-index: 10;
|
|
}
|
|
|
|
/* Wooden Card */
|
|
.login-card {
|
|
width: 480px;
|
|
background-color: var(--mc-wood);
|
|
border: 4px solid #000;
|
|
box-shadow:
|
|
8px 8px 0px rgba(0,0,0,0.5),
|
|
inset 4px 4px 0px var(--mc-wood-light),
|
|
inset -4px -4px 0px var(--mc-wood-dark);
|
|
padding: 32px;
|
|
position: relative;
|
|
}
|
|
|
|
/* Wood Grain Texture CSS Pattern */
|
|
.login-card::before {
|
|
content: "";
|
|
position: absolute;
|
|
top: 4px;
|
|
left: 4px;
|
|
right: 4px;
|
|
bottom: 4px;
|
|
background-image:
|
|
repeating-linear-gradient(45deg,
|
|
rgba(0,0,0,0.05) 0px,
|
|
rgba(0,0,0,0.05) 2px,
|
|
transparent 2px,
|
|
transparent 8px
|
|
);
|
|
pointer-events: none;
|
|
z-index: 0;
|
|
}
|
|
|
|
.content-layer {
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
|
|
/* Tabs */
|
|
.tabs {
|
|
display: flex;
|
|
margin-bottom: 24px;
|
|
border-bottom: 4px solid var(--mc-wood-dark);
|
|
}
|
|
|
|
.tab-btn {
|
|
flex: 1;
|
|
padding: 12px 0;
|
|
text-align: center;
|
|
cursor: pointer;
|
|
color: rgba(255, 255, 255, 0.6);
|
|
background: none;
|
|
border: none;
|
|
font-size: 14px;
|
|
transition: all 0.2s;
|
|
text-shadow: 2px 2px 0 #000;
|
|
}
|
|
|
|
.tab-btn.active {
|
|
color: #fff;
|
|
background-color: rgba(0, 0, 0, 0.1);
|
|
border-top: 4px solid var(--mc-wood-light);
|
|
border-left: 4px solid var(--mc-wood-light);
|
|
border-right: 4px solid var(--mc-wood-dark);
|
|
}
|
|
|
|
/* Form Elements */
|
|
.form-group {
|
|
margin-bottom: 24px;
|
|
position: relative;
|
|
}
|
|
|
|
.input-wrapper {
|
|
position: relative;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.input-icon {
|
|
position: absolute;
|
|
left: 16px;
|
|
color: #fff;
|
|
font-size: 16px;
|
|
z-index: 2;
|
|
text-shadow: 2px 2px 0 #000;
|
|
}
|
|
|
|
input[type="text"],
|
|
input[type="password"] {
|
|
width: 100%;
|
|
padding: 16px 16px 16px 48px;
|
|
background-color: #333;
|
|
border: 4px solid #000;
|
|
border-right-color: #555;
|
|
border-bottom-color: #555;
|
|
color: #fff;
|
|
font-size: 12px;
|
|
outline: none;
|
|
box-shadow: inset 4px 4px 0px #000;
|
|
}
|
|
|
|
input::placeholder {
|
|
color: #888;
|
|
}
|
|
|
|
input:focus {
|
|
background-color: #444;
|
|
}
|
|
|
|
.toggle-password {
|
|
position: absolute;
|
|
right: 16px;
|
|
cursor: pointer;
|
|
color: #aaa;
|
|
}
|
|
|
|
/* Checkbox */
|
|
.checkbox-group {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 24px;
|
|
font-size: 10px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.custom-checkbox {
|
|
width: 20px;
|
|
height: 20px;
|
|
background-color: #333;
|
|
border: 2px solid #000;
|
|
margin-right: 12px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
box-shadow: inset 2px 2px 0 #000;
|
|
}
|
|
|
|
.custom-checkbox i {
|
|
display: none;
|
|
font-size: 14px;
|
|
color: var(--mc-grass-top);
|
|
}
|
|
|
|
.checkbox-group.checked .custom-checkbox i {
|
|
display: block;
|
|
}
|
|
|
|
/* Password Strength */
|
|
.strength-meter {
|
|
height: 8px;
|
|
background-color: #000;
|
|
margin-top: 8px;
|
|
display: flex;
|
|
padding: 2px;
|
|
}
|
|
|
|
.strength-bar {
|
|
height: 100%;
|
|
width: 0%;
|
|
transition: width 0.3s, background-color 0.3s;
|
|
}
|
|
|
|
.strength-text {
|
|
font-size: 8px;
|
|
margin-top: 4px;
|
|
text-align: right;
|
|
color: #ddd;
|
|
}
|
|
|
|
/* Button */
|
|
.btn-minecraft {
|
|
width: 100%;
|
|
padding: 16px;
|
|
background-color: var(--mc-grass-top);
|
|
border: 4px solid #000;
|
|
color: #fff;
|
|
font-size: 16px;
|
|
cursor: pointer;
|
|
text-transform: uppercase;
|
|
text-shadow: 2px 2px 0px #000;
|
|
box-shadow:
|
|
inset 4px 4px 0px rgba(255,255,255,0.3),
|
|
inset -4px -4px 0px rgba(0,0,0,0.3),
|
|
4px 4px 0px #000;
|
|
transition: transform 0.1s, box-shadow 0.1s;
|
|
}
|
|
|
|
.btn-minecraft:active {
|
|
transform: translate(4px, 4px);
|
|
box-shadow: none;
|
|
}
|
|
|
|
.btn-minecraft:hover {
|
|
background-color: #7bc453;
|
|
}
|
|
|
|
/* Links */
|
|
.links {
|
|
margin-top: 24px;
|
|
text-align: center;
|
|
font-size: 10px;
|
|
}
|
|
|
|
.link-diamond {
|
|
color: var(--mc-diamond);
|
|
text-decoration: none;
|
|
text-shadow: 1px 1px 0 #000;
|
|
border-bottom: 2px solid transparent;
|
|
}
|
|
|
|
.link-diamond:hover {
|
|
border-bottom-color: var(--mc-diamond);
|
|
}
|
|
|
|
/* Error Message */
|
|
.error-msg {
|
|
color: var(--mc-redstone);
|
|
font-size: 10px;
|
|
margin-top: 8px;
|
|
text-shadow: 1px 1px 0 #000;
|
|
display: none;
|
|
}
|
|
|
|
/* Floating XP Orbs */
|
|
.xp-orb {
|
|
position: absolute;
|
|
width: 24px;
|
|
height: 24px;
|
|
background-color: #bcfc03;
|
|
border: 2px solid #6c8f02;
|
|
transform: rotate(45deg);
|
|
box-shadow: 0 0 10px #bcfc03;
|
|
animation: float 3s ease-in-out infinite;
|
|
}
|
|
|
|
.orb-1 { top: -40px; left: -40px; animation-delay: 0s; background-color: #bcfc03; }
|
|
.orb-2 { bottom: -30px; right: -30px; animation-delay: 1.5s; background-color: #64ffda; border-color: #009688; }
|
|
.orb-3 { top: 50%; right: -60px; animation-delay: 0.8s; width: 16px; height: 16px; }
|
|
|
|
@keyframes float {
|
|
0%, 100% { transform: rotate(45deg) translateY(0); }
|
|
50% { transform: rotate(45deg) translateY(-20px); }
|
|
}
|
|
|
|
/* Footer */
|
|
.footer {
|
|
position: fixed;
|
|
bottom: 0;
|
|
width: 100%;
|
|
height: 60px;
|
|
background-color: rgba(0,0,0,0.6);
|
|
backdrop-filter: blur(4px);
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
color: #fff;
|
|
font-size: 12px;
|
|
border-top: 4px solid rgba(0,0,0,0.4);
|
|
}
|
|
|
|
.online-players {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
}
|
|
|
|
.player-head {
|
|
width: 24px;
|
|
height: 24px;
|
|
background-color: #333;
|
|
border: 2px solid #fff;
|
|
image-rendering: pixelated;
|
|
}
|
|
|
|
.player-head:nth-child(2) { background-color: #AA0000; }
|
|
.player-head:nth-child(3) { background-color: #00AA00; }
|
|
.player-head:nth-child(4) { background-color: #0000AA; }
|
|
|
|
/* Grass Block Floor Decoration */
|
|
.grass-floor {
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 40px;
|
|
background-image:
|
|
linear-gradient(to right, var(--mc-grass-side) 50%, var(--mc-grass-top) 50%),
|
|
linear-gradient(to bottom, transparent 50%, var(--mc-dirt-side) 50%);
|
|
background-size: 40px 40px, 100% 40px;
|
|
z-index: 5;
|
|
display: none; /* Hidden to keep clean look, or show for immersion */
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<nav class="navbar">
|
|
<div class="logo">
|
|
<i class="ri-box-3-fill"></i>
|
|
CSP Learning Platform
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="clouds"></div>
|
|
|
|
<div class="main-container">
|
|
<div class="login-card">
|
|
<!-- Decorative Orbs -->
|
|
<div class="xp-orb orb-1"></div>
|
|
<div class="xp-orb orb-2"></div>
|
|
<div class="xp-orb orb-3"></div>
|
|
|
|
<div class="content-layer">
|
|
<div class="tabs">
|
|
<button class="tab-btn active" onclick="switchTab('login')">Login</button>
|
|
<button class="tab-btn" onclick="switchTab('register')">Register</button>
|
|
</div>
|
|
|
|
<form id="authForm" onsubmit="handleLogin(event)">
|
|
<div class="form-group">
|
|
<div class="input-wrapper">
|
|
<i class="ri-user-smile-fill input-icon"></i>
|
|
<input type="text" id="username" placeholder="Username" autocomplete="off">
|
|
</div>
|
|
<div id="username-error" class="error-msg">Username must be at least 3 chars!</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<div class="input-wrapper">
|
|
<i class="ri-lock-fill input-icon"></i>
|
|
<input type="password" id="password" placeholder="Password" oninput="checkStrength()">
|
|
<i class="ri-eye-off-fill toggle-password" onclick="togglePassword()"></i>
|
|
</div>
|
|
<div class="strength-meter">
|
|
<div class="strength-bar" id="strength-bar"></div>
|
|
</div>
|
|
<div class="strength-text" id="strength-text"></div>
|
|
<div id="password-error" class="error-msg">Password must be at least 6 chars!</div>
|
|
</div>
|
|
|
|
<div class="checkbox-group" onclick="toggleRemember(this)">
|
|
<div class="custom-checkbox">
|
|
<i class="ri-check-fill"></i>
|
|
</div>
|
|
<span>Remember me</span>
|
|
</div>
|
|
|
|
<button type="submit" class="btn-minecraft" id="submit-btn">Login</button>
|
|
</form>
|
|
|
|
<div class="links">
|
|
<a href="#" class="link-diamond">Forgot password?</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<footer class="footer">
|
|
<div class="online-players">
|
|
<span>Online Players: <span style="color: var(--mc-gold);">12,002</span></span>
|
|
<div class="player-head"></div>
|
|
<div class="player-head"></div>
|
|
<div class="player-head"></div>
|
|
</div>
|
|
</footer>
|
|
|
|
<script>
|
|
let isLogin = true;
|
|
let rememberMe = false;
|
|
|
|
function switchTab(tab) {
|
|
const btns = document.querySelectorAll('.tab-btn');
|
|
const submitBtn = document.getElementById('submit-btn');
|
|
const form = document.getElementById('authForm');
|
|
|
|
// Clear errors
|
|
document.querySelectorAll('.error-msg').forEach(el => el.style.display = 'none');
|
|
|
|
if (tab === 'login') {
|
|
isLogin = true;
|
|
btns[0].classList.add('active');
|
|
btns[1].classList.remove('active');
|
|
submitBtn.innerText = 'Login';
|
|
} else {
|
|
isLogin = false;
|
|
btns[0].classList.remove('active');
|
|
btns[1].classList.add('active');
|
|
submitBtn.innerText = 'Register';
|
|
}
|
|
}
|
|
|
|
function togglePassword() {
|
|
const pwdInput = document.getElementById('password');
|
|
const icon = document.querySelector('.toggle-password');
|
|
if (pwdInput.type === 'password') {
|
|
pwdInput.type = 'text';
|
|
icon.classList.remove('ri-eye-off-fill');
|
|
icon.classList.add('ri-eye-fill');
|
|
} else {
|
|
pwdInput.type = 'password';
|
|
icon.classList.remove('ri-eye-fill');
|
|
icon.classList.add('ri-eye-off-fill');
|
|
}
|
|
}
|
|
|
|
function toggleRemember(el) {
|
|
el.classList.toggle('checked');
|
|
rememberMe = !rememberMe;
|
|
}
|
|
|
|
function checkStrength() {
|
|
const pwd = document.getElementById('password').value;
|
|
const bar = document.getElementById('strength-bar');
|
|
const text = document.getElementById('strength-text');
|
|
|
|
if (pwd.length === 0) {
|
|
bar.style.width = '0%';
|
|
bar.style.backgroundColor = 'transparent';
|
|
text.innerText = '';
|
|
return;
|
|
}
|
|
|
|
let strength = 0;
|
|
if (pwd.length >= 6) strength++;
|
|
if (pwd.match(/[a-z]/) && pwd.match(/[0-9]/)) strength++;
|
|
if (pwd.length > 8 && pwd.match(/[^a-zA-Z0-9]/)) strength++;
|
|
|
|
if (strength === 1) {
|
|
bar.style.width = '33%';
|
|
bar.style.backgroundColor = '#E53935'; // Weak
|
|
text.innerText = 'Weak';
|
|
text.style.color = '#E53935';
|
|
} else if (strength === 2) {
|
|
bar.style.width = '66%';
|
|
bar.style.backgroundColor = '#FFD700'; // Medium
|
|
text.innerText = 'Medium';
|
|
text.style.color = '#FFD700';
|
|
} else {
|
|
bar.style.width = '100%';
|
|
bar.style.backgroundColor = '#7CB342'; // Strong
|
|
text.innerText = 'Strong';
|
|
text.style.color = '#7CB342';
|
|
}
|
|
}
|
|
|
|
function handleLogin(e) {
|
|
e.preventDefault();
|
|
const user = document.getElementById('username').value;
|
|
const pass = document.getElementById('password').value;
|
|
const userErr = document.getElementById('username-error');
|
|
const passErr = document.getElementById('password-error');
|
|
|
|
let isValid = true;
|
|
|
|
// Reset errors
|
|
userErr.style.display = 'none';
|
|
passErr.style.display = 'none';
|
|
|
|
if (user.length < 3) {
|
|
userErr.style.display = 'block';
|
|
isValid = false;
|
|
}
|
|
if (pass.length < 6) {
|
|
passErr.style.display = 'block';
|
|
isValid = false;
|
|
}
|
|
|
|
if (!isValid) return;
|
|
|
|
// Mock login check
|
|
if (isLogin) {
|
|
if (user === 'test' && pass === 'whoami139') {
|
|
// Success
|
|
const token = 'mock_token_' + Date.now();
|
|
localStorage.setItem('authToken', token);
|
|
if(rememberMe) localStorage.setItem('savedUser', user);
|
|
|
|
// Simulate redirect with a nice alert or console log since we are in a static file context
|
|
// In a real app: window.location.href = 'problem-library.html';
|
|
const btn = document.getElementById('submit-btn');
|
|
btn.innerText = 'Connecting...';
|
|
btn.style.backgroundColor = '#FFD700'; // Gold color loading
|
|
|
|
setTimeout(() => {
|
|
// We just reload or show success for this demo
|
|
btn.innerText = 'Success!';
|
|
btn.style.backgroundColor = '#7CB342';
|
|
// Simulating redirect
|
|
// window.location.href = 'problem-library.html';
|
|
console.log("Redirecting to problem-library.html");
|
|
}, 1000);
|
|
} else {
|
|
// Wrong credentials
|
|
// Create a generic error message for demo
|
|
passErr.innerText = 'Invalid username or password!';
|
|
passErr.style.display = 'block';
|
|
}
|
|
} else {
|
|
// Register logic mock
|
|
alert(`Registered user: ${user}`);
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |