- 使用 HTML + CSS + JavaScript 实现 - 实现完整的游戏逻辑:方块移动、旋转、消行、计分 - 支持等级系统和加速机制 - 响应式设计,支持移动端 - 下一个方块预览功能 - 游戏暂停/继续功能
181 lines
3.1 KiB
CSS
181 lines
3.1 KiB
CSS
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
padding: 20px;
|
|
}
|
|
|
|
.game-container {
|
|
background: rgba(255, 255, 255, 0.95);
|
|
border-radius: 20px;
|
|
padding: 30px;
|
|
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
max-width: 900px;
|
|
}
|
|
|
|
.header {
|
|
text-align: center;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.header h1 {
|
|
font-size: 2.5rem;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
background-clip: text;
|
|
}
|
|
|
|
.game-area {
|
|
display: flex;
|
|
gap: 30px;
|
|
justify-content: center;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.info-panel {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 15px;
|
|
}
|
|
|
|
.info-box {
|
|
background: #f8f9fa;
|
|
padding: 15px;
|
|
border-radius: 10px;
|
|
text-align: center;
|
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.info-box h3 {
|
|
font-size: 0.9rem;
|
|
color: #666;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.info-value {
|
|
font-size: 1.5rem;
|
|
font-weight: bold;
|
|
color: #667eea;
|
|
}
|
|
|
|
#next-canvas {
|
|
background: #fff;
|
|
border: 2px solid #667eea;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.canvas-container {
|
|
position: relative;
|
|
}
|
|
|
|
#game-canvas {
|
|
background: #1a1a2e;
|
|
border: 3px solid #667eea;
|
|
border-radius: 10px;
|
|
display: block;
|
|
}
|
|
|
|
.game-over {
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
background: rgba(255, 255, 255, 0.98);
|
|
padding: 40px;
|
|
border-radius: 15px;
|
|
text-align: center;
|
|
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
|
|
z-index: 10;
|
|
}
|
|
|
|
.game-over.hidden {
|
|
display: none;
|
|
}
|
|
|
|
.game-over h2 {
|
|
font-size: 2rem;
|
|
color: #e74c3c;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.game-over p {
|
|
font-size: 1.2rem;
|
|
margin-bottom: 20px;
|
|
color: #333;
|
|
}
|
|
|
|
.controls-panel {
|
|
background: #f8f9fa;
|
|
padding: 20px;
|
|
border-radius: 10px;
|
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
min-width: 200px;
|
|
}
|
|
|
|
.controls-panel h3 {
|
|
color: #667eea;
|
|
margin-bottom: 15px;
|
|
text-align: center;
|
|
}
|
|
|
|
.controls-panel ul {
|
|
list-style: none;
|
|
}
|
|
|
|
.controls-panel li {
|
|
padding: 8px 0;
|
|
color: #555;
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
.btn {
|
|
width: 100%;
|
|
padding: 12px 24px;
|
|
margin-top: 20px;
|
|
font-size: 1rem;
|
|
font-weight: bold;
|
|
color: white;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
border: none;
|
|
border-radius: 8px;
|
|
cursor: pointer;
|
|
transition: transform 0.2s, box-shadow 0.2s;
|
|
}
|
|
|
|
.btn:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
|
|
}
|
|
|
|
.btn:active {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
@media (max-width: 900px) {
|
|
.game-area {
|
|
flex-direction: column;
|
|
align-items: center;
|
|
}
|
|
|
|
.info-panel {
|
|
flex-direction: row;
|
|
flex-wrap: wrap;
|
|
justify-content: center;
|
|
}
|
|
|
|
.controls-panel {
|
|
min-width: 100%;
|
|
text-align: center;
|
|
}
|
|
}
|