* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", sans-serif;
}

body {
    background: #f7f8fa;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* 游戏外层容器 */
.game-container {
    position: relative;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    overflow: visible;
    max-width: 100%;
}

/* 响应式缩放 */
@media (max-width: 400px) {
    .game-container {
        transform: scale(0.9);
        transform-origin: top center;
    }
}

@media (max-width: 350px) {
    .game-container {
        transform: scale(0.8);
    }
}

/* 游戏画布 */
#gameCanvas {
    background: #2c2c2c;
    display: block;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

/* 得分展示 */
.score-box {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    z-index: 10;
}

/* 返回首页按钮 */
.home-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 30;
    padding: 8px 20px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background: #00d8ff;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
}

.home-btn:hover {
    background: #00b3cc;
    transform: translateY(-2px);
}

.home-btn:disabled {
    background: #888;
    cursor: not-allowed;
    transform: none;
}

/* 初始开局界面 */
.start-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 20;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    pointer-events: auto;
}

.start-box h2 {
    font-size: 36px;
    margin-bottom: 20px;
    color: #00d8ff;
}

.start-box p {
    font-size: 16px;
    color: #ccc;
    margin-bottom: 30px;
    line-height: 1.8;
    text-align: center;
}

.btn-group {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 12px 36px;
    font-size: 18px;
    border: none;
    border-radius: 8px;
    background: #00d8ff;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
}

.btn-secondary {
    background: #fff;
    color: #000;
}

.btn:hover {
    background: #00b3cc;
    transform: translateY(-2px);
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* 游戏结束弹窗 */
.over-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 20;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    pointer-events: auto;
}

.over-box h2 {
    font-size: 32px;
    color: #ff4444;
    margin-bottom: 15px;
}

.over-box p {
    font-size: 20px;
    margin-bottom: 30px;
}

/* 排行榜弹窗 */
.ranking-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 25;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    pointer-events: auto;
}

.ranking-content {
    width: 80%;
    max-height: 80%;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
}

.ranking-table th, .ranking-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.ranking-table th {
    color: #00d8ff;
}

.pagination {
    display: flex;
    gap: 10px;
    align-items: center;
}

.page-btn {
    padding: 5px 15px;
    background: #00d8ff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #000;
    font-weight: bold;
}

.page-btn:disabled {
    background: #555;
    cursor: not-allowed;
}

/* 底部操作提示 */
.tip-text {
    margin-top: 20px;
    color: #666;
    font-size: 14px;
}

/* Toast动画 */
@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    90% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* 屏幕震动动画 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
