332 lines
6.2 KiB
CSS
Executable File
332 lines
6.2 KiB
CSS
Executable File
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Arial', sans-serif;
|
|
background: linear-gradient(135deg, #a8e6cf 0%, #dcedc8 50%, #f1f8e9 100%);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
touch-action: manipulation;
|
|
-webkit-tap-highlight-color: transparent;
|
|
}
|
|
|
|
.game-container {
|
|
background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 100%);
|
|
border-radius: 20px;
|
|
padding: 20px;
|
|
box-shadow: 0 20px 40px rgba(46, 125, 50, 0.3);
|
|
max-width: 400px;
|
|
width: 95%;
|
|
margin: 20px auto;
|
|
border: 1px solid rgba(46, 125, 50, 0.2);
|
|
}
|
|
|
|
.game-header {
|
|
text-align: center;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.game-header h1 {
|
|
color: #1b5e20;
|
|
font-size: 2.5rem;
|
|
margin-bottom: 15px;
|
|
text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5);
|
|
}
|
|
|
|
.score-board {
|
|
display: flex;
|
|
justify-content: space-around;
|
|
background: linear-gradient(135deg, #2e7d32 0%, #388e3c 100%);
|
|
padding: 12px;
|
|
border-radius: 15px;
|
|
color: white;
|
|
font-weight: bold;
|
|
font-size: 1.1rem;
|
|
box-shadow: 0 4px 8px rgba(46, 125, 50, 0.2);
|
|
}
|
|
|
|
.score-board span {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
}
|
|
|
|
.game-canvas-container {
|
|
display: flex;
|
|
justify-content: center;
|
|
margin: 20px 0;
|
|
}
|
|
|
|
#gameCanvas {
|
|
border: 3px solid #2e7d32;
|
|
border-radius: 10px;
|
|
background: #1b5e20;
|
|
box-shadow: 0 8px 16px rgba(46, 125, 50, 0.3);
|
|
}
|
|
|
|
.game-controls {
|
|
margin: 20px 0;
|
|
}
|
|
|
|
.control-row {
|
|
display: flex;
|
|
justify-content: center;
|
|
margin: 8px 0;
|
|
}
|
|
|
|
.control-btn {
|
|
width: 70px;
|
|
height: 70px;
|
|
margin: 0 10px;
|
|
border: none;
|
|
border-radius: 50%;
|
|
background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
|
|
color: white;
|
|
font-size: 1.5rem;
|
|
font-weight: bold;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
box-shadow: 0 4px 8px rgba(46, 125, 50, 0.3);
|
|
}
|
|
|
|
.control-btn:hover {
|
|
box-shadow: 0 6px 12px rgba(46, 125, 50, 0.4);
|
|
}
|
|
|
|
.control-btn:active {
|
|
box-shadow: 0 2px 4px rgba(46, 125, 50, 0.2);
|
|
}
|
|
|
|
#pauseBtn {
|
|
background: linear-gradient(135deg, #81c784 0%, #a5d6a7 100%);
|
|
color: #1b5e20;
|
|
font-size: 1.2rem;
|
|
}
|
|
|
|
.game-instructions {
|
|
text-align: center;
|
|
color: #2e7d32;
|
|
font-size: 0.9rem;
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.modal {
|
|
display: none;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: rgba(46, 125, 50, 0.6);
|
|
z-index: 1000;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.modal-content {
|
|
background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 100%);
|
|
padding: 30px;
|
|
border-radius: 20px;
|
|
text-align: center;
|
|
max-width: 400px;
|
|
width: 90%;
|
|
box-shadow: 0 20px 40px rgba(46, 125, 50, 0.4);
|
|
border: 1px solid rgba(46, 125, 50, 0.2);
|
|
}
|
|
|
|
.modal-content h2 {
|
|
color: #1b5e20;
|
|
margin-bottom: 20px;
|
|
font-size: 2rem;
|
|
text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
|
|
}
|
|
|
|
.stats p {
|
|
margin: 10px 0;
|
|
font-size: 1.1rem;
|
|
color: #2e7d32;
|
|
}
|
|
|
|
.stats span {
|
|
font-weight: bold;
|
|
color: #1b5e20;
|
|
}
|
|
|
|
.restart-btn {
|
|
background: linear-gradient(135deg, #2e7d32 0%, #388e3c 100%);
|
|
color: white;
|
|
border: none;
|
|
padding: 15px 30px;
|
|
border-radius: 25px;
|
|
font-size: 1.2rem;
|
|
font-weight: bold;
|
|
cursor: pointer;
|
|
margin-top: 20px;
|
|
transition: all 0.3s ease;
|
|
box-shadow: 0 4px 8px rgba(46, 125, 50, 0.2);
|
|
}
|
|
|
|
.restart-btn:hover {
|
|
box-shadow: 0 8px 16px rgba(46, 125, 50, 0.3);
|
|
}
|
|
|
|
/* 排行榜样式 */
|
|
.leaderboard {
|
|
margin: 20px 0;
|
|
padding: 15px;
|
|
background: rgba(255, 255, 255, 0.3);
|
|
border-radius: 15px;
|
|
border: 1px solid rgba(46, 125, 50, 0.2);
|
|
}
|
|
|
|
.leaderboard-summary {
|
|
margin: 10px 0 15px;
|
|
padding: 10px 12px;
|
|
background: rgba(255, 255, 255, 0.5);
|
|
border-radius: 12px;
|
|
color: #1b5e20;
|
|
text-align: center;
|
|
border: 1px solid rgba(46, 125, 50, 0.2);
|
|
}
|
|
|
|
.leaderboard-summary p {
|
|
margin: 6px 0;
|
|
}
|
|
|
|
.leaderboard h3 {
|
|
color: #1b5e20;
|
|
margin-bottom: 15px;
|
|
font-size: 1.3rem;
|
|
text-align: center;
|
|
}
|
|
|
|
.leaderboard-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
}
|
|
|
|
.leaderboard-item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 8px 12px;
|
|
background: rgba(255, 255, 255, 0.5);
|
|
border-radius: 10px;
|
|
font-size: 0.9rem;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.leaderboard-item.current-player {
|
|
background: linear-gradient(135deg, #ffeb3b 0%, #fff176 100%);
|
|
font-weight: bold;
|
|
border: 2px solid #f57f17;
|
|
}
|
|
|
|
.leaderboard-item .rank {
|
|
font-weight: bold;
|
|
min-width: 30px;
|
|
text-align: left;
|
|
}
|
|
|
|
.leaderboard-item .player-name {
|
|
flex: 1;
|
|
text-align: left;
|
|
margin-left: 10px;
|
|
color: #2e7d32;
|
|
}
|
|
|
|
.leaderboard-item .player-score {
|
|
font-weight: bold;
|
|
color: #1b5e20;
|
|
min-width: 50px;
|
|
text-align: right;
|
|
}
|
|
|
|
.leaderboard-item .player-time {
|
|
color: #4a5568;
|
|
font-size: 0.8rem;
|
|
min-width: 80px;
|
|
text-align: right;
|
|
}
|
|
|
|
/* 手机端优化 */
|
|
@media (max-width: 768px) {
|
|
.game-container {
|
|
padding: 15px;
|
|
margin: 10px;
|
|
border-radius: 15px;
|
|
}
|
|
|
|
.game-header h1 {
|
|
font-size: 2rem;
|
|
}
|
|
|
|
.score-board {
|
|
font-size: 0.9rem;
|
|
padding: 8px;
|
|
}
|
|
|
|
.control-btn {
|
|
width: 60px;
|
|
height: 60px;
|
|
font-size: 1.3rem;
|
|
margin: 0 8px;
|
|
}
|
|
|
|
#pauseBtn {
|
|
font-size: 1rem;
|
|
}
|
|
|
|
#gameCanvas {
|
|
width: 280px;
|
|
height: 400px;
|
|
}
|
|
}
|
|
|
|
/* 超小屏幕优化 */
|
|
@media (max-width: 480px) {
|
|
.game-header h1 {
|
|
font-size: 1.8rem;
|
|
}
|
|
|
|
.score-board {
|
|
flex-direction: column;
|
|
gap: 5px;
|
|
}
|
|
|
|
.control-btn {
|
|
width: 50px;
|
|
height: 50px;
|
|
font-size: 1.1rem;
|
|
margin: 0 5px;
|
|
}
|
|
|
|
#gameCanvas {
|
|
width: 250px;
|
|
height: 350px;
|
|
}
|
|
|
|
.modal-content {
|
|
padding: 20px;
|
|
}
|
|
|
|
.modal-content h2 {
|
|
font-size: 1.5rem;
|
|
}
|
|
}
|
|
|
|
/* 防止文本选择 */
|
|
.control-btn, .restart-btn {
|
|
user-select: none;
|
|
-webkit-user-select: none;
|
|
-moz-user-select: none;
|
|
-ms-user-select: none;
|
|
}
|
|
|
|
/* 动画效果已删除 */ |