Files
2025-12-13 20:53:50 +08:00

575 lines
12 KiB
CSS
Executable File

/* 基础样式重置 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
}
body {
font-family: 'Arial', sans-serif;
background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 30%, #f9fbe7 70%, #f0f4c3 100%);
color: #2e7d32;
height: 100vh;
overflow: hidden;
user-select: none;
}
/* 游戏容器 */
.game-container {
height: 100vh;
display: flex;
flex-direction: column;
max-width: 800px;
margin: 0 auto;
padding: 10px;
background: linear-gradient(135deg, rgba(232, 245, 232, 0.4) 0%, rgba(241, 248, 233, 0.4) 50%, rgba(249, 251, 231, 0.4) 100%);
border-radius: 20px;
box-shadow: 0 10px 30px rgba(139, 195, 74, 0.2);
backdrop-filter: blur(10px);
}
/* 游戏头部 */
.game-header {
text-align: center;
margin-bottom: 15px;
}
.game-header h1 {
font-size: 2rem;
margin-bottom: 10px;
background: linear-gradient(135deg, #4caf50 0%, #8bc34a 50%, #cddc39 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.3);
font-weight: bold;
}
.score-board {
display: flex;
justify-content: center;
gap: 20px;
flex-wrap: wrap;
}
.score-item {
background: linear-gradient(135deg, #66bb6a 0%, #8bc34a 50%, #aed581 100%);
color: white;
padding: 8px 15px;
border-radius: 20px;
backdrop-filter: blur(10px);
border: 1px solid rgba(139, 195, 74, 0.3);
box-shadow: 0 4px 12px rgba(139, 195, 74, 0.3);
transition: all 0.3s ease;
}
.score-item:hover {
transform: translateY(-2px);
box-shadow: 0 6px 16px rgba(139, 195, 74, 0.4);
}
.score-item .label {
font-size: 0.9rem;
opacity: 0.9;
}
.score-item span:last-child {
font-weight: bold;
margin-left: 5px;
}
/* 游戏主体 */
.game-main {
display: flex;
flex: 1;
gap: 20px;
justify-content: center;
align-items: flex-start;
}
.game-board {
position: relative;
border-radius: 15px;
overflow: hidden;
box-shadow: 0 15px 35px rgba(139, 195, 74, 0.3);
background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 50%, #f9fbe7 100%);
border: 3px solid transparent;
background-clip: padding-box;
}
.game-board::before {
content: '';
position: absolute;
top: -3px;
left: -3px;
right: -3px;
bottom: -3px;
background: linear-gradient(135deg, #66bb6a 0%, #8bc34a 50%, #aed581 100%);
border-radius: 15px;
z-index: -1;
}
#gameCanvas {
display: block;
background: linear-gradient(135deg, #2e7d32 0%, #388e3c 50%, #4caf50 100%);
border-radius: 12px;
}
/* 游戏覆盖层 */
.game-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(139, 195, 74, 0.8);
display: flex;
align-items: center;
justify-content: center;
backdrop-filter: blur(8px);
border-radius: 12px;
}
.overlay-content {
text-align: center;
background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 50%, #f9fbe7 100%);
color: #2e7d32;
padding: 30px;
border-radius: 20px;
border: 2px solid rgba(139, 195, 74, 0.4);
box-shadow: 0 15px 30px rgba(139, 195, 74, 0.3);
backdrop-filter: blur(10px);
}
.overlay-content h2 {
margin-bottom: 15px;
font-size: 1.8rem;
background: linear-gradient(135deg, #4caf50 0%, #8bc34a 50%, #cddc39 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
font-weight: bold;
}
.overlay-content p {
margin-bottom: 20px;
opacity: 0.8;
color: #388e3c;
}
/* 游戏按钮 */
.game-btn {
background: linear-gradient(45deg, #66bb6a 0%, #8bc34a 50%, #aed581 100%);
border: none;
color: white;
padding: 12px 24px;
border-radius: 25px;
cursor: pointer;
font-size: 1rem;
margin: 5px;
transition: all 0.3s ease;
box-shadow: 0 4px 15px rgba(139, 195, 74, 0.3);
font-weight: 600;
}
.game-btn:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(139, 195, 74, 0.4);
background: linear-gradient(45deg, #8bc34a 0%, #aed581 50%, #c5e1a5 100%);
}
.game-btn:active {
transform: translateY(0);
}
/* 侧边栏 */
.game-sidebar {
display: flex;
flex-direction: column;
gap: 20px;
min-width: 150px;
}
/* 手机端控制 */
.mobile-controls {
display: none;
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
pointer-events: none;
z-index: 20;
}
.mobile-controls-left {
position: absolute;
left: 10px;
display: flex;
flex-direction: column;
gap: 15px;
pointer-events: auto;
}
.mobile-controls-right {
position: absolute;
right: 10px;
display: flex;
flex-direction: column;
gap: 15px;
pointer-events: auto;
}
.control-btn {
width: 55px;
height: 55px;
border: none;
border-radius: 50%;
background: linear-gradient(45deg, #66bb6a 0%, #8bc34a 50%, #aed581 100%);
color: white;
font-size: 1.4rem;
cursor: pointer;
transition: all 0.2s ease;
box-shadow: 0 4px 15px rgba(139, 195, 74, 0.3);
user-select: none;
backdrop-filter: blur(10px);
border: 2px solid rgba(255, 255, 255, 0.2);
}
.control-btn:active {
transform: scale(0.9);
box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
/* 游戏统计界面 */
.game-stats {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(46, 125, 50, 0.9);
display: none;
align-items: center;
justify-content: center;
z-index: 1000;
backdrop-filter: blur(10px);
}
.stats-content {
background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 100%);
color: #1b5e20;
padding: 30px;
border-radius: 20px;
text-align: center;
max-width: 90%;
width: 400px;
box-shadow: 0 20px 40px rgba(46, 125, 50, 0.4);
border: 1px solid rgba(46, 125, 50, 0.3);
}
.stats-content h2 {
margin-bottom: 25px;
font-size: 2rem;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.stats-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 15px;
margin-bottom: 25px;
}
.stat-item {
background: linear-gradient(135deg, #2e7d32 0%, #388e3c 100%);
color: white;
padding: 15px;
border-radius: 10px;
border: 1px solid rgba(46, 125, 50, 0.3);
box-shadow: 0 4px 8px rgba(46, 125, 50, 0.2);
}
.stat-label {
display: block;
font-size: 0.9rem;
opacity: 0.9;
margin-bottom: 5px;
}
.stat-value {
display: block;
font-size: 1.4rem;
font-weight: bold;
}
.achievement {
background: linear-gradient(45deg, #81c784, #66bb6a);
color: white;
padding: 15px;
border-radius: 10px;
margin-bottom: 25px;
font-weight: bold;
min-height: 50px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 8px rgba(46, 125, 50, 0.3);
}
/* 排行榜样式 */
.leaderboard {
background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 100%);
color: #2e7d32;
border: 1px solid rgba(46, 125, 50, 0.3);
border-radius: 16px;
box-shadow: 0 6px 18px rgba(46, 125, 50, 0.25);
padding: 16px;
margin-bottom: 20px;
}
.leaderboard-title {
font-weight: 700;
font-size: 1.2rem;
margin-bottom: 12px;
background: linear-gradient(135deg, #4caf50 0%, #8bc34a 50%, #cddc39 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.leaderboard-wrap {
max-height: 260px;
overflow: auto;
border-radius: 12px;
}
.leaderboard-table {
width: 100%;
border-collapse: collapse;
}
.leaderboard-table thead tr {
background: linear-gradient(135deg, #66bb6a 0%, #8bc34a 100%);
color: #fff;
}
.leaderboard-table th,
.leaderboard-table td {
text-align: left;
padding: 10px 12px;
border-bottom: 1px solid rgba(46, 125, 50, 0.15);
font-size: 0.95rem;
}
.leaderboard-table tbody tr {
background: linear-gradient(135deg, rgba(46,125,50,0.08) 0%, rgba(46,125,50,0.03) 100%);
transition: background 0.2s ease, transform 0.2s ease;
}
.leaderboard-table tbody tr:hover {
background: linear-gradient(135deg, rgba(46,125,50,0.12) 0%, rgba(46,125,50,0.06) 100%);
transform: translateY(-1px);
}
.rank-badge {
display: inline-block;
min-width: 32px;
text-align: center;
padding: 4px 8px;
border-radius: 12px;
background: linear-gradient(45deg, #66bb6a, #8bc34a);
color: #fff;
font-weight: 700;
}
.current-row {
outline: 2px solid rgba(76, 175, 80, 0.7);
box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.15) inset;
}
.leaderboard-tip {
margin-top: 10px;
font-size: 0.85rem;
color: #388e3c;
opacity: 0.85;
}
/* 响应式设计 */
@media (max-width: 768px) {
.game-container {
padding: 5px;
position: relative;
}
.game-header h1 {
font-size: 1.5rem;
}
.score-board {
gap: 10px;
}
.score-item {
padding: 6px 12px;
font-size: 0.9rem;
}
.game-main {
flex-direction: column;
align-items: center;
gap: 15px;
position: relative;
}
.game-board {
position: relative;
z-index: 10;
}
.game-sidebar {
flex-direction: row;
justify-content: center;
min-width: unset;
width: 100%;
}
.mobile-controls {
display: block;
}
#gameCanvas {
width: 250px;
height: 500px;
}
.stats-grid {
grid-template-columns: 1fr;
gap: 10px;
}
.stats-content {
padding: 20px;
width: 95%;
}
.leaderboard-wrap {
max-height: 200px;
}
.leaderboard-table th,
.leaderboard-table td {
padding: 8px 10px;
font-size: 0.9rem;
}
}
@media (max-width: 480px) {
.game-header h1 {
font-size: 1.3rem;
}
.score-board {
gap: 8px;
}
.score-item {
padding: 4px 8px;
font-size: 0.8rem;
}
#gameCanvas {
width: 200px;
height: 400px;
}
.control-btn {
width: 45px;
height: 45px;
font-size: 1.2rem;
}
.mobile-controls-left,
.mobile-controls-right {
gap: 10px;
}
.mobile-controls-left {
left: 5px;
}
.mobile-controls-right {
right: 5px;
}
.game-sidebar {
flex-direction: column;
gap: 10px;
}
}
/* 隐藏类 */
.hidden {
display: none !important;
}
/* 动画效果 */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.fade-in {
animation: fadeIn 0.5s ease-out;
}
@keyframes pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.05); }
}
.pulse {
animation: pulse 2s infinite;
}
/* 摘要卡片 */
.leaderboard-summary {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px;
margin-bottom: 16px;
}
.summary-item {
background: linear-gradient(135deg, #2e7d32 0%, #388e3c 100%);
color: #fff;
padding: 12px;
border-radius: 10px;
border: 1px solid rgba(46, 125, 50, 0.3);
box-shadow: 0 4px 8px rgba(46, 125, 50, 0.2);
}
.summary-label {
display: block;
font-size: 0.9rem;
opacity: 0.9;
}
.summary-value {
display: block;
font-size: 1.3rem;
font-weight: 700;
margin-top: 4px;
}
@media (max-width: 768px) {
.leaderboard-summary {
grid-template-columns: 1fr;
gap: 10px;
}
}