460 lines
7.9 KiB
CSS
460 lines
7.9 KiB
CSS
/* 基础样式重置 */
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
-webkit-tap-highlight-color: transparent;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Arial', sans-serif;
|
|
background: linear-gradient(135deg, #1e3c72, #2a5298);
|
|
color: white;
|
|
height: 100vh;
|
|
overflow: hidden;
|
|
user-select: none;
|
|
}
|
|
|
|
/* 游戏容器 */
|
|
.game-container {
|
|
height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
padding: 10px;
|
|
}
|
|
|
|
/* 游戏头部 */
|
|
.game-header {
|
|
text-align: center;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.game-header h1 {
|
|
font-size: 2rem;
|
|
margin-bottom: 10px;
|
|
text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
|
|
}
|
|
|
|
.score-board {
|
|
display: flex;
|
|
justify-content: center;
|
|
gap: 20px;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.score-item {
|
|
background: rgba(255,255,255,0.1);
|
|
padding: 8px 15px;
|
|
border-radius: 20px;
|
|
backdrop-filter: blur(10px);
|
|
border: 1px solid rgba(255,255,255,0.2);
|
|
}
|
|
|
|
.score-item .label {
|
|
font-size: 0.9rem;
|
|
opacity: 0.8;
|
|
}
|
|
|
|
.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: 10px;
|
|
overflow: hidden;
|
|
box-shadow: 0 10px 30px rgba(0,0,0,0.3);
|
|
}
|
|
|
|
#gameCanvas {
|
|
display: block;
|
|
background: #1a1a1a;
|
|
border: 2px solid #333;
|
|
}
|
|
|
|
/* 游戏覆盖层 */
|
|
.game-overlay {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background: rgba(0,0,0,0.8);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
backdrop-filter: blur(5px);
|
|
}
|
|
|
|
.overlay-content {
|
|
text-align: center;
|
|
background: rgba(255,255,255,0.1);
|
|
padding: 30px;
|
|
border-radius: 15px;
|
|
border: 1px solid rgba(255,255,255,0.2);
|
|
}
|
|
|
|
.overlay-content h2 {
|
|
margin-bottom: 15px;
|
|
font-size: 1.8rem;
|
|
}
|
|
|
|
.overlay-content p {
|
|
margin-bottom: 20px;
|
|
opacity: 0.8;
|
|
}
|
|
|
|
/* 游戏按钮 */
|
|
.game-btn {
|
|
background: linear-gradient(45deg, #667eea, #764ba2);
|
|
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(0,0,0,0.2);
|
|
}
|
|
|
|
.game-btn:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 6px 20px rgba(0,0,0,0.3);
|
|
}
|
|
|
|
.game-btn:active {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
/* 侧边栏 */
|
|
.game-sidebar {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 20px;
|
|
min-width: 150px;
|
|
}
|
|
|
|
.next-piece {
|
|
background: rgba(255,255,255,0.1);
|
|
padding: 15px;
|
|
border-radius: 10px;
|
|
border: 1px solid rgba(255,255,255,0.2);
|
|
text-align: center;
|
|
}
|
|
|
|
.next-piece h3 {
|
|
margin-bottom: 10px;
|
|
font-size: 1.1rem;
|
|
}
|
|
|
|
#nextCanvas {
|
|
background: #1a1a1a;
|
|
border: 1px solid #333;
|
|
border-radius: 5px;
|
|
}
|
|
|
|
.controls-info {
|
|
background: rgba(255,255,255,0.1);
|
|
padding: 15px;
|
|
border-radius: 10px;
|
|
border: 1px solid rgba(255,255,255,0.2);
|
|
}
|
|
|
|
.controls-info h3 {
|
|
margin-bottom: 15px;
|
|
font-size: 1.1rem;
|
|
text-align: center;
|
|
}
|
|
|
|
.control-item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 8px;
|
|
padding: 5px 0;
|
|
}
|
|
|
|
.control-item .key {
|
|
background: rgba(255,255,255,0.2);
|
|
padding: 4px 8px;
|
|
border-radius: 4px;
|
|
font-family: monospace;
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
.control-item .desc {
|
|
font-size: 0.9rem;
|
|
opacity: 0.8;
|
|
}
|
|
|
|
/* 手机端控制 */
|
|
.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, #667eea, #764ba2);
|
|
color: white;
|
|
font-size: 1.4rem;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
box-shadow: 0 4px 15px rgba(0,0,0,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(0,0,0,0.9);
|
|
display: none;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 1000;
|
|
backdrop-filter: blur(10px);
|
|
}
|
|
|
|
.stats-content {
|
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
|
padding: 30px;
|
|
border-radius: 20px;
|
|
text-align: center;
|
|
max-width: 90%;
|
|
width: 400px;
|
|
box-shadow: 0 20px 40px rgba(0,0,0,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: rgba(255,255,255,0.1);
|
|
padding: 15px;
|
|
border-radius: 10px;
|
|
border: 1px solid rgba(255,255,255,0.2);
|
|
}
|
|
|
|
.stat-label {
|
|
display: block;
|
|
font-size: 0.9rem;
|
|
opacity: 0.8;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.stat-value {
|
|
display: block;
|
|
font-size: 1.4rem;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.achievement {
|
|
background: linear-gradient(45deg, #f093fb, #f5576c);
|
|
padding: 15px;
|
|
border-radius: 10px;
|
|
margin-bottom: 25px;
|
|
font-weight: bold;
|
|
min-height: 50px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
/* 响应式设计 */
|
|
@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%;
|
|
}
|
|
|
|
.next-piece,
|
|
.controls-info {
|
|
flex: 1;
|
|
max-width: 200px;
|
|
}
|
|
|
|
.mobile-controls {
|
|
display: block;
|
|
}
|
|
|
|
#gameCanvas {
|
|
width: 250px;
|
|
height: 500px;
|
|
}
|
|
|
|
.stats-grid {
|
|
grid-template-columns: 1fr;
|
|
gap: 10px;
|
|
}
|
|
|
|
.stats-content {
|
|
padding: 20px;
|
|
width: 95%;
|
|
}
|
|
}
|
|
|
|
@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;
|
|
}
|
|
|
|
.next-piece,
|
|
.controls-info {
|
|
max-width: unset;
|
|
}
|
|
}
|
|
|
|
/* 隐藏类 */
|
|
.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;
|
|
}
|