Files
snake-game/style.css
openclaw dab43051ab 阶段1:项目初始化完成
- 创建基础项目结构
- 实现 HTML/CSS/JS 基础框架
- 配置游戏界面和样式

Closes #1
2026-02-27 14:01:03 +00:00

178 lines
2.6 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;
}
.container {
background: rgba(255, 255, 255, 0.95);
border-radius: 20px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
padding: 30px;
max-width: 600px;
width: 100%;
}
header {
text-align: center;
margin-bottom: 20px;
}
header h1 {
color: #333;
font-size: 2.5em;
margin-bottom: 10px;
}
.score-board {
font-size: 1.5em;
color: #764ba2;
font-weight: bold;
}
#score {
color: #e74c3c;
}
main {
text-align: center;
}
.game-controls {
margin-bottom: 20px;
display: flex;
justify-content: center;
gap: 10px;
}
.btn {
padding: 10px 20px;
font-size: 16px;
border: none;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s ease;
font-weight: bold;
}
#startBtn {
background: #27ae60;
color: white;
}
#startBtn:hover {
background: #229954;
}
#pauseBtn {
background: #f39c12;
color: white;
}
#pauseBtn:hover {
background: #e67e22;
}
#pauseBtn:disabled {
background: #ccc;
cursor: not-allowed;
}
#resetBtn {
background: #e74c3c;
color: white;
}
#resetBtn:hover {
background: #c0392b;
}
.difficulty-selector {
margin-bottom: 20px;
font-size: 1.1em;
color: #333;
}
#difficulty {
padding: 5px 10px;
font-size: 16px;
border: 2px solid #764ba2;
border-radius: 5px;
background: white;
cursor: pointer;
}
#gameCanvas {
background: #2c3e50;
border: 4px solid #34495e;
border-radius: 10px;
display: block;
margin: 0 auto 20px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.game-info {
text-align: left;
background: #f8f9fa;
padding: 15px;
border-radius: 8px;
border-left: 4px solid #764ba2;
}
.game-info h3 {
color: #333;
margin-bottom: 10px;
}
.game-info ul {
list-style: none;
padding-left: 0;
}
.game-info li {
padding: 5px 0;
color: #555;
position: relative;
padding-left: 20px;
}
.game-info li::before {
content: "🎮";
position: absolute;
left: 0;
}
@media (max-width: 600px) {
.container {
padding: 20px;
}
header h1 {
font-size: 1.8em;
}
#gameCanvas {
width: 100%;
height: auto;
}
.game-controls {
flex-wrap: wrap;
}
.btn {
flex: 1;
min-width: 80px;
}
}