<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>拟态登录页面 | 昼夜自适应</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
transition: background 1.5s ease;
overflow: hidden;
background: #f0f4f8;
}
.day-mode {
background: linear-gradient(135deg, #e0e7ff, #dbeafe);
}
.night-mode {
background: linear-gradient(135deg, #0f172a, #1e293b);
}
.container {
position: relative;
width: 100%;
max-width: 420px;
padding: 40px;
}
.card {
background: #ffffff;
border-radius: 24px;
padding: 45px 40px;
z-index: 10;
position: relative;
box-shadow:
0 15px 35px rgba(0, 0, 0, 0.1),
inset 0 0 30px rgba(255, 255, 255, 0.7);
border: 1px solid rgba(255, 255, 255, 0.8);
overflow: hidden;
}
.night-mode .card {
background: linear-gradient(145deg, #1e293b, #0f172a);
box-shadow:
0 15px 35px rgba(0, 0, 0, 0.3),
inset 0 0 15px rgba(95, 101, 255, 0.1);
border: 1px solid rgba(99, 102, 241, 0.2);
}
.card::before {
content: '';
position: absolute;
width: 200%;
height: 200%;
top: -50%;
left: -50%;
background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
z-index: -1;
}
.night-mode .card::before {
background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, rgba(255,255,255,0) 70%);
}
.header {
text-align: center;
margin-bottom: 40px;
}
.header h1 {
font-size: 32px;
font-weight: 700;
letter-spacing: 0.5px;
margin-bottom: 8px;
background: linear-gradient(135deg, #4f46e5, #8b5cf6);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.night-mode .header h1 {
background: linear-gradient(135deg, #38bdf8, #818cf8);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.header p {
color: #64748b;
font-size: 15px;
font-weight: 500;
}
.night-mode .header p {
color: #94a3b8;
}
.input-group {
position: relative;
margin-bottom: 30px;
background: #f8fafc;
border-radius: 14px;
box-shadow:
inset 0 1px 3px rgba(0,0,0,0.05),
0 4px 6px -2px rgba(0,0,0,0.05);
padding: 3px;
transition: all 0.3s ease;
}
.night-mode .input-group {
background: rgba(15, 23, 42, 0.6);
box-shadow:
inset 0 1px 3px rgba(0,0,0,0.3),
0 4px 6px -2px rgba(0,0,0,0.15);
}
.input-group.focused {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), inset 0 1px 3px rgba(0,0,0,0.05);
}
.night-mode .input-group.focused {
box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2), inset 0 1px 3px rgba(0,0,0,0.1);
}
.input-group input {
width: 100%;
height: 54px;
background: #ffffff;
border: none;
border-radius: 12px;
padding: 0 20px 0 50px;
font-size: 16px;
font-weight: 500;
outline: none;
transition: all 0.3s ease;
box-shadow: 0 1px 2px rgba(0,0,0,0.02);
color: #1e293b;
}
.night-mode .input-group input {
background: rgba(30, 41, 59, 0.6);
color: #e2e8f0;
}
.input-group input:focus {
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}
.input-group i {
position: absolute;
left: 20px;
top: 50%;
transform: translateY(-50%);
color: #4f46e5;
font-size: 18px;
z-index: 2;
}
.night-mode .input-group i {
color: #818cf8;
}
.remember-forgot {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
font-size: 14px;
}
.remember-forgot label {
color: #475569;
display: flex;
align-items: center;
cursor: pointer;
font-weight: 500;
}
.night-mode .remember-forgot label {
color: #cbd5e1;
}
.remember-forgot a {
color: #4f46e5;
text-decoration: none;
font-weight: 600;
transition: all 0.2s ease;
}
.night-mode .remember-forgot a {
color: #818cf8;
}
.remember-forgot a:hover {
color: #7c3aed;
text-decoration: underline;
}
.night-mode .remember-forgot a:hover {
color: #38bdf8;
}
.btn-login {
width: 100%;
height: 54px;
background: linear-gradient(135deg, #6366f1, #8b5cf6);
border: none;
border-radius: 14px;
color: white;
font-size: 17px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
box-shadow:
0 4px 6px -1px rgba(99, 102, 241, 0.3),
0 2px 4px -2px rgba(99, 102, 241, 0.3);
position: relative;
overflow: hidden;
}
.btn-login:hover {
transform: translateY(-2px);
box-shadow:
0 10px 15px -3px rgba(99, 102, 241, 0.3),
0 4px 6px -4px rgba(99, 102, 241, 0.3);
}
.btn-login:active {
transform: translateY(1px);
}
.signup-link {
text-align: center;
margin-top: 35px;
color: #64748b;
font-size: 15px;
font-weight: 500;
}
.night-mode .signup-link {
color: #94a3b8;
}
.signup-link a {
color: #6366f1;
text-decoration: none;
font-weight: 600;
transition: all 0.2s ease;
position: relative;
}
.night-mode .signup-link a {
color: #818cf8;
}
.signup-link a::after {
content: '';
position: absolute;
width: 0;
height: 2px;
bottom: -2px;
left: 0;
background: currentColor;
transition: width 0.3s ease;
}
.signup-link a:hover::after {
width: 100%;
}
.shapes {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
}
.shape {
position: absolute;
border-radius: 50%;
opacity: 0.15;
animation: float 8s infinite ease-in-out;
}
.shape:nth-child(1) {
width: 180px;
height: 180px;
top: 15%;
left: 10%;
background: linear-gradient(135deg, #4f46e5, #8b5cf6);
animation-delay: 0s;
}
.shape:nth-child(2) {
width: 140px;
height: 140px;
top: 55%;
right: 10%;
background: linear-gradient(135deg, #8b5cf6, #ec4899);
animation-delay: -2s;
}
.shape:nth-child(3) {
width: 100px;
height: 100px;
bottom: 15%;
left: 20%;
background: linear-gradient(135deg, #10b981, #3b82f6);
animation-delay: -4s;
}
.night-mode .shape {
opacity: 0.12;
}
.time-indicator {
position: absolute;
top: 25px;
right: 25px;
display: flex;
align-items: center;
color: #4f46e5;
font-size: 14px;
font-weight: 600;
background: rgba(248, 250, 252, 0.8);
padding: 8px 15px;
border-radius: 30px;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}
.night-mode .time-indicator {
color: #818cf8;
background: rgba(15, 23, 42, 0.7);
}
.mode-icon {
margin-right: 8px;
font-size: 18px;
}
@keyframes float {
0%, 100% { transform: translateY(0) rotate(0deg); }
50% { transform: translateY(-20px) rotate(5deg); }
}
input[type="checkbox"] {
appearance: none;
-webkit-appearance: none;
width: 20px;
height: 20px;
border-radius: 6px;
margin-right: 10px;
position: relative;
cursor: pointer;
border: 2px solid #cbd5e1;
background: #f1f5f9;
transition: all 0.2s ease;
}
input[type="checkbox"]:checked {
background: #4f46e5;
border-color: #4f46e5;
}
.night-mode input[type="checkbox"] {
border: 2px solid #475569;
background: #1e293b;
}
.night-mode input[type="checkbox"]:checked {
background: #818cf8;
border-color: #818cf8;
}
input[type="checkbox"]:checked::before {
content: '\f00c';
font-family: "Font Awesome 6 Free";
font-weight: 900;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
font-size: 12px;
}
.additional-features {
display: flex;
justify-content: center;
gap: 20px;
margin-top: 25px;
}
.feature-btn {
width: 46px;
height: 46px;
border-radius: 14px;
display: flex;
align-items: center;
justify-content: center;
background: #f1f5f9;
color: #64748b;
font-size: 20px;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
transition: all 0.2s ease;
}
.night-mode .feature-btn {
background: rgba(15, 23, 42, 0.6);
color: #94a3b8;
}
.feature-btn:hover {
transform: translateY(-3px);
background: #4f46e5;
color: white;
}
.night-mode .feature-btn:hover {
background: #818cf8;
}
@media (max-width: 480px) {
.container {
padding: 25px;
}
.card {
padding: 35px 25px;
}
.header h1 {
font-size: 28px;
}
.time-indicator {
top: 15px;
right: 15px;
}
}
</style>
</head>
<body>
<div class="shapes">
<div class="shape"></div>
<div class="shape"></div>
<div class="shape"></div>
</div>
<div class="container">
<div class="card">
<div class="header">
<h1>欢迎登录</h1>
<p>请输入您的账户信息</p>
</div>
<div class="input-group">
<i class="fas fa-user"></i>
<input type="text" placeholder="用户名" required>
</div>
<div class="input-group">
<i class="fas fa-lock"></i>
<input type="password" placeholder="密码" required>
</div>
<div class="remember-forgot">
<label>
<input type="checkbox"> 记住我
</label>
<a href="#">忘记密码?</a>
</div>
<button class="btn-login">登 录</button>
<div class="signup-link">
还没有账户? <a href="#">立即注册</a>
</div>
<div class="additional-features">
<div class="feature-btn">
<i class="fab fa-google"></i>
</div>
<div class="feature-btn">
<i class="fab fa-facebook-f"></i>
</div>
<div class="feature-btn">
<i class="fab fa-apple"></i>
</div>
</div>
</div>
</div>
<div class="time-indicator">
<i class="mode-icon"></i>
<span class="mode-text"></span>
</div>
<script>
function setThemeBasedOnTime() {
const date = new Date();
const hours = date.getHours();
const minutes = date.getMinutes();
const body = document.body;
const modeIcon = document.querySelector('.mode-icon');
const modeText = document.querySelector('.mode-text');
if (hours >= 6 && hours < 20) {
body.classList.add('day-mode');
body.classList.remove('night-mode');
modeIcon.className = 'mode-icon fas fa-sun';
modeText.textContent = `白天模式 (${hours}:${minutes.toString().padStart(2, '0')})`;
}
else {
body.classList.add('night-mode');
body.classList.remove('day-mode');
modeIcon.className = 'mode-icon fas fa-moon-stars';
modeText.textContent = `夜晚模式 (${hours}:${minutes.toString().padStart(2, '0')})`;
}
}
document.querySelectorAll('.input-group input').forEach(input => {
input.addEventListener('focus', function() {
this.parentElement.classList.add('focused');
});
input.addEventListener('blur', function() {
this.parentElement.classList.remove('focused');
});
});
const loginBtn = document.querySelector('.btn-login');
loginBtn.addEventListener('click', function() {
this.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 登录中...';
setTimeout(() => {
this.innerHTML = '登 录';
}, 2000);
});
setThemeBasedOnTime();
setInterval(setThemeBasedOnTime, 60000);
</script>
</body>
</html>
index.html