/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 禁用文字选择和长按选中（移动端）- 但保留按钮和输入框 */
body, canvas, div:not(.controls):not(.mobile-controls), span, p, h1, h2, h3 {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* 确保按钮和输入框可以交互 */
button, input, select, textarea, a {
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
    user-select: auto;
    touch-action: auto;
    pointer-events: auto;
}

/* ==================== 加载遮罩层 ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* 移动端使用动态视口高度 */
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    overflow: hidden;
}

.loading-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    padding: 40px;
    background: rgba(0, 20, 40, 0.6);
    border: 2px solid #00ff88;
    border-radius: 15px;
    box-shadow: 
        0 0 40px rgba(0, 255, 136, 0.4),
        inset 0 0 30px rgba(0, 255, 136, 0.1);
}

.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 4px solid transparent;
    border-top-color: #00ff88;
    border-radius: 50%;
    animation: spinCentered 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

.spinner-ring:nth-child(1) {
    animation-delay: 0s;
    border-top-color: #00ff88;
}

.spinner-ring:nth-child(2) {
    width: 70%;
    height: 70%;
    top: 50%;
    left: 50%;
    border-top-color: #00ddff;
    animation: spinCentered 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    animation-delay: 0.3s;
}

.spinner-ring:nth-child(3) {
    width: 40%;
    height: 40%;
    top: 50%;
    left: 50%;
    border-top-color: #f5fe42;
    animation: spinCentered 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    animation-delay: 0.6s;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes spinCentered {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.loading-title {
    font-size: 28px;
    font-weight: 700;
    color: #00ff88;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 
        0 0 15px rgba(0, 255, 136, 0.8),
        0 0 30px rgba(0, 255, 136, 0.4);
    font-family: 'Courier New', monospace;
    animation: titleGlow 2s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% {
        text-shadow: 
            0 0 15px rgba(0, 255, 136, 0.8),
            0 0 30px rgba(0, 255, 136, 0.4);
    }
    50% {
        text-shadow: 
            0 0 25px rgba(0, 255, 136, 1),
            0 0 50px rgba(0, 255, 136, 0.6);
    }
}

.loading-text {
    font-size: 16px;
    color: #00ddff;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 221, 255, 0.5);
    animation: textPulse 1.5s ease-in-out infinite;
}

@keyframes textPulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* 移动端加载屏幕优化 */
@media (max-width: 768px) {
    .loading-overlay {
        position: fixed;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        min-height: -webkit-fill-available;
    }
    
    .loading-content {
        padding: 30px 20px;
        gap: 20px;
        max-width: 90vw;
        margin: 0 auto;
    }
    
    .loading-spinner {
        width: 60px;
        height: 60px;
    }
    
    .loading-title {
        font-size: 16px;
        letter-spacing: 2px;
        text-align: center;
        white-space: nowrap;
    }
    
    .loading-text {
        font-size: 14px;
        text-align: center;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .loading-content {
        padding: 25px 15px;
        gap: 15px;
    }
    
    .loading-spinner {
        width: 50px;
        height: 50px;
    }
    
    .loading-title {
        font-size: 13px;
        letter-spacing: 1px;
        line-height: 1.4;
        word-break: keep-all;
    }
    
    .loading-text {
        font-size: 12px;
    }
}

/* 极小屏幕（iPhone SE等） */
@media (max-width: 375px) {
    .loading-title {
        font-size: 12px;
        letter-spacing: 0.5px;
    }
    
    .loading-spinner {
        width: 45px;
        height: 45px;
    }
}

@keyframes scanline {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100vh); }
}

@keyframes glow {
    0%, 100% { text-shadow: 0 0 10px #00ff88, 0 0 20px #00ff88, 0 0 30px #00ff88; }
    50% { text-shadow: 0 0 20px #00ff88, 0 0 30px #00ff88, 0 0 40px #00ff88; }
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* 防止移动端页面滚动 */
html {
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
    background: #0a0e27;
    background-image: 
        repeating-linear-gradient(0deg, rgba(0, 255, 136, 0.03) 0px, transparent 1px, transparent 2px, rgba(0, 255, 136, 0.03) 3px),
        radial-gradient(ellipse at center, #0a0e27 0%, #000000 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #00ff88;
    position: relative;
    overflow-x: hidden;
    /* 移动端触控优化 */
    overscroll-behavior: none; /* 禁用过度滚动效果 */
}

/* 防止加载时出现布局偏移 */
body.loading {
    overflow: hidden;
}

body.loading .container {
    visibility: hidden;
}

/* CRT 扫描线效果 - 静态版本 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1),
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 9999;
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* 顶部栏 - 极客风格 */
.header {
    background: transparent;
    padding: 8px 0;
    margin-bottom: 25px;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #00ff88;
    text-transform: uppercase;
    letter-spacing: 5px;
    text-shadow: 
        0 0 15px rgba(0, 255, 136, 0.8), 
        0 0 30px rgba(0, 255, 136, 0.4),
        0 0 45px rgba(0, 255, 136, 0.2);
    font-family: 'Courier New', monospace;
}

/* 游戏主区域 */
.game-wrapper {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
    max-width: 1200px;
    margin: 0 auto;
}

/* 信息面板 - 像素风格 */
.info-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 240px;
}

.info-card {
    background: rgba(0, 20, 40, 0.8);
    padding: 15px;
    border: 2px solid #00ff88;
    border-radius: 0;
    box-shadow: 
        0 0 15px rgba(0, 255, 136, 0.2),
        inset 0 0 15px rgba(0, 255, 136, 0.05);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* 等级卡片升级特效 */
.info-card.level-up-card {
    animation: cardLevelUp 0.6s ease-out;
}

@keyframes cardLevelUp {
    0% {
        border-color: #00ff88;
        box-shadow: 
            0 0 15px rgba(0, 255, 136, 0.2),
            inset 0 0 15px rgba(0, 255, 136, 0.05);
    }
    25% {
        border-color: #f5fe42;
        box-shadow: 
            0 0 40px rgba(245, 254, 66, 0.8),
            inset 0 0 30px rgba(245, 254, 66, 0.2);
        transform: scale(1.05);
    }
    50% {
        border-color: #00ddff;
        box-shadow: 
            0 0 50px rgba(0, 221, 255, 1),
            inset 0 0 35px rgba(0, 221, 255, 0.25);
    }
    75% {
        border-color: #f5fe42;
        box-shadow: 
            0 0 45px rgba(245, 254, 66, 0.9),
            inset 0 0 32px rgba(245, 254, 66, 0.22);
        transform: scale(1.03);
    }
    100% {
        border-color: #00ff88;
        box-shadow: 
            0 0 25px rgba(0, 255, 136, 0.5),
            inset 0 0 20px rgba(0, 255, 136, 0.1);
        transform: scale(1);
    }
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, #00ff88, transparent);
}

.info-label {
    font-size: 11px;
    color: #00ddff;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    text-shadow: 0 0 5px rgba(0, 221, 255, 0.5);
}

.info-value {
    font-size: 32px;
    font-weight: 700;
    color: #00ff88;
    font-family: 'Courier New', monospace;
    text-shadow: 
        0 0 10px rgba(0, 255, 136, 0.8),
        0 0 20px rgba(0, 255, 136, 0.4);
    letter-spacing: 2px;
    transition: all 0.3s ease;
}

/* 等级升级动画 */
.info-value.level-up {
    animation: levelUpPulse 0.6s ease-out;
}

@keyframes levelUpPulse {
    0% {
        transform: scale(1);
        color: #00ff88;
        text-shadow: 
            0 0 10px rgba(0, 255, 136, 0.8),
            0 0 20px rgba(0, 255, 136, 0.4);
    }
    25% {
        transform: scale(1.5);
        color: #f5fe42;
        text-shadow: 
            0 0 30px rgba(245, 254, 66, 1),
            0 0 60px rgba(245, 254, 66, 0.8),
            0 0 90px rgba(245, 254, 66, 0.6);
    }
    50% {
        transform: scale(1.3) rotate(5deg);
        color: #00ddff;
        text-shadow: 
            0 0 40px rgba(0, 221, 255, 1),
            0 0 70px rgba(0, 221, 255, 0.8);
    }
    75% {
        transform: scale(1.4) rotate(-5deg);
        color: #f5fe42;
        text-shadow: 
            0 0 35px rgba(245, 254, 66, 1),
            0 0 65px rgba(245, 254, 66, 0.8);
    }
    100% {
        transform: scale(1);
        color: #00ff88;
        text-shadow: 
            0 0 15px rgba(0, 255, 136, 1),
            0 0 30px rgba(0, 255, 136, 0.6);
    }
}

/* 等级进度条 */
.level-progress {
    margin-top: 10px;
    height: 8px;
    background: rgba(0, 20, 40, 0.6);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.level-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, 
        #00ff88 0%, 
        #00ddff 50%, 
        #00ff88 100%);
    width: 0%;
    transition: width 0.5s ease;
    box-shadow: 
        0 0 10px rgba(0, 255, 136, 0.8),
        inset 0 0 5px rgba(255, 255, 255, 0.3);
    position: relative;
    animation: progressGlow 2s ease-in-out infinite;
}

@keyframes progressGlow {
    0%, 100% {
        box-shadow: 
            0 0 10px rgba(0, 255, 136, 0.8),
            inset 0 0 5px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 
            0 0 20px rgba(0, 255, 136, 1),
            inset 0 0 8px rgba(255, 255, 255, 0.5);
    }
}

@keyframes levelUpFlash {
    0% {
        transform: scaleY(1);
        filter: brightness(1);
    }
    50% {
        transform: scaleY(1.5);
        filter: brightness(2);
    }
    100% {
        transform: scaleY(1);
        filter: brightness(1);
    }
}

.next-piece-container {
    background: rgba(0, 20, 40, 0.8);
    padding: 15px;
    border: 2px solid #f5fe42;
    border-radius: 0;
    box-shadow: 
        0 0 15px rgba(245, 254, 66, 0.3),
        inset 0 0 15px rgba(245, 254, 66, 0.05);
}

.next-piece-container .info-label {
    color: #f5fe42;
    text-shadow: 0 0 5px rgba(245, 254, 66, 0.5);
}

#nextPieceCanvas {
    display: block;
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #f5fe42;
    border-radius: 0;
    box-shadow: inset 0 0 10px rgba(245, 254, 66, 0.2);
}

/* 游戏场地 - 主屏幕 */
.game-area {
    position: relative;
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border: 3px solid #00ff88;
    border-radius: 0;
    box-shadow: 
        0 0 30px rgba(0, 255, 136, 0.4),
        inset 0 0 30px rgba(0, 255, 136, 0.1);
    position: relative;
}

.game-area::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, #00ff88, #00ddff, #f5fe42, #00ff88);
    background-size: 400% 400%;
    z-index: -1;
    opacity: 0.2;
}

#gameCanvas {
    display: block;
    background: #000000;
    border: 2px solid #001f3f;
    border-radius: 0;
    box-shadow: 
        inset 0 0 50px rgba(0, 255, 136, 0.1),
        inset 0 0 20px rgba(0, 0, 0, 0.8);
}

/* 游戏遮罩层 - 赛博风格 */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 8, 20, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0;
    backdrop-filter: blur(10px);
    border: 2px solid #00ff88;
}

.game-overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    padding: 40px;
    background: rgba(0, 0, 0, 0.8);
}

.overlay-content h2 {
    font-size: 36px;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 
        0 0 10px rgba(0, 255, 136, 0.8),
        0 0 20px rgba(0, 255, 136, 0.5),
        0 0 30px rgba(0, 255, 136, 0.3);
}

.overlay-stats {
    font-size: 16px;
    margin-bottom: 30px;
    line-height: 2;
    color: #00ddff;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* 移动端操作提示 */
.mobile-tips {
    display: none;
    background: rgba(0, 20, 40, 0.8);
    padding: 15px;
    border: 2px solid #00ff88;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

.mobile-tips p {
    margin: 5px 0;
}

.mobile-tips strong {
    color: #f5fe42;
}

/* 控制面板 - 终端风格 */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 320px;
}

.control-section {
    background: rgba(0, 20, 40, 0.8);
    padding: 12px;
    border: 2px solid #00ddff;
    border-radius: 0;
    box-shadow: 
        0 0 15px rgba(0, 221, 255, 0.2),
        inset 0 0 15px rgba(0, 221, 255, 0.05);
}

.control-section h3 {
    font-size: 12px;
    color: #00ddff;
    margin-bottom: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 8px rgba(0, 221, 255, 0.6);
    border-bottom: 1px solid rgba(0, 221, 255, 0.3);
    padding-bottom: 6px;
}

/* 按钮样式 - 霓虹风格 */
.btn {
    padding: 12px 24px;
    border: 2px solid #00ff88;
    border-radius: 0;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    position: relative;
    overflow: hidden;
}

.btn:last-child {
    margin-bottom: 0;
}

.btn-primary {
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
    box-shadow: 
        0 0 15px rgba(0, 255, 136, 0.3),
        inset 0 0 15px rgba(0, 255, 136, 0.05);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.8);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 255, 136, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
    border-radius: 50%;
}

.btn-primary:hover:not(:disabled)::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 
        0 0 25px rgba(0, 255, 136, 0.6),
        0 4px 20px rgba(0, 255, 136, 0.4),
        inset 0 0 20px rgba(0, 255, 136, 0.1);
    border-color: #00ffaa;
}

.btn-secondary {
    background: rgba(0, 221, 255, 0.1);
    color: #00ddff;
    border-color: #00ddff;
    box-shadow: 
        0 0 15px rgba(0, 221, 255, 0.2),
        inset 0 0 15px rgba(0, 221, 255, 0.05);
    text-shadow: 0 0 10px rgba(0, 221, 255, 0.8);
}

.btn-logout {
    background: rgba(255, 77, 77, 0.1);
    color: #ff6b6b;
    border-color: #ff6b6b;
    box-shadow: 
        0 0 15px rgba(255, 77, 77, 0.2),
        inset 0 0 15px rgba(255, 77, 77, 0.05);
    text-shadow: 0 0 10px rgba(255, 77, 77, 0.8);
    font-size: 14px;
    padding: 10px 20px;
    min-width: 100px;
}

.btn-logout:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 
        0 0 25px rgba(255, 77, 77, 0.5),
        0 4px 20px rgba(255, 77, 77, 0.3),
        inset 0 0 20px rgba(255, 77, 77, 0.1);
    border-color: #ff8888;
    background: rgba(255, 77, 77, 0.15);
}

.btn-logout:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 
        0 0 20px rgba(255, 77, 77, 0.4),
        inset 0 0 20px rgba(255, 77, 77, 0.15);
}

.btn-secondary:hover:not(:disabled) {
    box-shadow: 
        0 0 20px rgba(0, 221, 255, 0.4),
        inset 0 0 20px rgba(0, 221, 255, 0.1);
    border-color: #00eeff;
}

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    box-shadow: none;
}

.btn.hidden {
    display: none;
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
    letter-spacing: 1px;
    margin-top: 5px;
}

/* 操作说明 - 终端风格 */
.instructions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: #00ff88;
    font-family: 'Courier New', monospace;
    padding: 5px 6px;
    border-left: 2px solid rgba(0, 255, 136, 0.3);
    transition: all 0.3s ease;
}

.instruction-item:hover {
    border-left-color: #00ff88;
    background: rgba(0, 255, 136, 0.05);
    padding-left: 12px;
}

.icon {
    width: 18px;
    height: 18px;
    color: #00ddff;
    filter: drop-shadow(0 0 3px rgba(0, 221, 255, 0.6));
}

/* 游戏规则 - 像素风格 */
.rules p {
    font-size: 11px;
    color: #00ff88;
    line-height: 1.8;
    margin-bottom: 6px;
    font-family: 'Courier New', monospace;
    padding-left: 8px;
    border-left: 1px solid rgba(0, 255, 136, 0.2);
}

.rules p:last-child {
    margin-bottom: 0;
}

.rules p::before {
    content: '>';
    margin-right: 8px;
    color: #00ddff;
    font-weight: bold;
}

.rules .rule-highlight {
    background: rgba(245, 254, 66, 0.1);
    padding: 10px 12px;
    border-radius: 0;
    border: 1px solid #f5fe42;
    border-left: 3px solid #f5fe42;
    color: #f5fe42;
    font-weight: 700;
    margin: 10px 0;
    box-shadow: 
        0 0 15px rgba(245, 254, 66, 0.2),
        inset 0 0 15px rgba(245, 254, 66, 0.05);
    text-shadow: 0 0 5px rgba(245, 254, 66, 0.5);
}

/* 页脚 - 极客风格 */
.footer {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    color: #00ff88;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.5);
    border-top: 1px solid rgba(0, 255, 136, 0.2);
    padding-top: 15px;
}

.footer::before {
    content: '▲ ';
    color: #00ddff;
}

.footer::after {
    content: ' ▼';
    color: #f5fe42;
}

.footer a {
    color: #00ddff;
    text-decoration: none;
    font-weight: 700;
    text-shadow: 0 0 5px rgba(0, 221, 255, 0.5);
    transition: all 0.3s ease;
}

.footer a:hover {
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

/* 为角落添加装饰元素 */
.container::before,
.container::after {
    font-family: 'Courier New', monospace;
    font-size: 24px;
    position: fixed;
    opacity: 0.3;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.6);
    pointer-events: none;
}

.container::before {
    content: '◢';
    top: 10px;
    left: 10px;
}

.container::after {
    content: '◣';
    top: 10px;
    right: 10px;
}

/* 音频控制按钮 */
.audio-controls {
    margin-bottom: 0;
}

.audio-toggle-group {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.audio-toggle-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #888;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 11px;
    font-weight: 600;
}

.audio-toggle-btn .icon {
    width: 24px;
    height: 24px;
}

.audio-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.audio-toggle-btn.active {
    background: rgba(76, 175, 80, 0.2);
    border-color: #4CAF50;
    color: #4CAF50;
}

.audio-toggle-btn.active:hover {
    background: rgba(76, 175, 80, 0.3);
}

/* 消除行评价动画 */
.combo-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.8),
        0 0 20px rgba(255, 215, 0, 0.6),
        0 0 30px rgba(255, 215, 0, 0.4),
        3px 3px 6px rgba(0, 0, 0, 0.5);
    z-index: 100;
    pointer-events: none;
    white-space: nowrap;
    letter-spacing: 3px;
    opacity: 0;
    display: none;
}

.combo-text.show {
    display: block;
    animation: comboPopup 1s ease-out forwards;
}

.combo-text.combo-1 {
    color: #4CAF50;
    text-shadow: 
        0 0 10px rgba(76, 175, 80, 0.8),
        0 0 20px rgba(76, 175, 80, 0.6),
        3px 3px 6px rgba(0, 0, 0, 0.5);
}

.combo-text.combo-2 {
    color: #6925f9;
    text-shadow: 
        0 0 10px rgba(105, 37, 249, 0.8),
        0 0 20px rgba(105, 37, 249, 0.6),
        3px 3px 6px rgba(0, 0, 0, 0.5);
}

.combo-text.combo-3 {
    color: #f5fe42;
    text-shadow: 
        0 0 10px rgba(245, 254, 66, 0.8),
        0 0 20px rgba(245, 254, 66, 0.6),
        3px 3px 6px rgba(0, 0, 0, 0.5);
}

.combo-text.combo-4 {
    color: #f50057;
    font-size: 56px;
    text-shadow: 
        0 0 10px rgba(245, 0, 87, 0.8),
        0 0 20px rgba(245, 0, 87, 0.6),
        0 0 30px rgba(245, 0, 87, 0.4),
        3px 3px 6px rgba(0, 0, 0, 0.5);
}

/* 升级文字特效 */
.combo-text.level-up-text {
    font-size: 60px;
    background: linear-gradient(45deg, #f5fe42, #00ddff, #00ff88, #f5fe42);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: levelUpGradient 1.2s ease-in-out;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgba(245, 254, 66, 0.8))
            drop-shadow(0 0 40px rgba(0, 221, 255, 0.6))
            drop-shadow(0 0 60px rgba(0, 255, 136, 0.4));
}

@keyframes levelUpGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 里程碑合成特效 */
.combo-text.milestone-text {
    font-size: 64px;
    background: linear-gradient(45deg, #ff0080, #ff8c00, #ffd700, #ff0080);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 1))
            drop-shadow(0 0 40px rgba(255, 140, 0, 0.8))
            drop-shadow(0 0 60px rgba(255, 0, 128, 0.6))
            drop-shadow(3px 3px 8px rgba(0, 0, 0, 0.7));
}

.combo-text.milestone-text.show {
    display: block;
    animation: milestonePopup 0.8s ease-out forwards, milestoneGradient 0.8s ease-in-out infinite;
}

@keyframes milestonePopup {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    5% {
        transform: translate(-50%, -50%) scale(0.4) rotate(-5deg);
    }
    10% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.3) rotate(5deg);
    }
    15% {
        transform: translate(-50%, -50%) scale(1.1) rotate(-3deg);
    }
    20% {
        transform: translate(-50%, -50%) scale(1.25) rotate(3deg);
    }
    25% {
        transform: translate(-50%, -50%) scale(1.15) rotate(-2deg);
    }
    30% {
        transform: translate(-50%, -50%) scale(1.2) rotate(0deg);
    }
    70% {
        opacity: 1;
        transform: translate(-50%, -55%) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -70%) scale(0.9);
    }
}

@keyframes milestoneGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes comboPopup {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    10% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -60%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -80%) scale(0.8);
    }
}

/* 分数累加动画 */
.score-popup {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    font-weight: 700;
    color: #ffd700;
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.8),
        0 0 20px rgba(255, 215, 0, 0.6),
        2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 99;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    display: none;
    text-align: center;
    line-height: 1.5;
}

.score-popup.show {
    display: block;
    animation: scorePopup 1.5s ease-out forwards;
}

/* 分数数字样式（用于累加显示） */
.score-popup .score-item {
    display: block;
    animation: scoreItemAppear 0.3s ease-out forwards;
    opacity: 0;
}

.score-popup .score-total {
    display: block;
    font-size: 42px;
    font-weight: 900;
    margin-top: 8px;
    animation: scoreTotalAppear 0.5s ease-out forwards;
    opacity: 0;
}

/* 根据combo等级设置颜色 */
.score-popup.combo-1 {
    color: #4CAF50;
    text-shadow: 
        0 0 10px rgba(76, 175, 80, 0.8),
        0 0 20px rgba(76, 175, 80, 0.6),
        2px 2px 4px rgba(0, 0, 0, 0.5);
}

.score-popup.combo-2 {
    color: #6925f9;
    text-shadow: 
        0 0 10px rgba(105, 37, 249, 0.8),
        0 0 20px rgba(105, 37, 249, 0.6),
        2px 2px 4px rgba(0, 0, 0, 0.5);
}

.score-popup.combo-3 {
    color: #f5fe42;
    text-shadow: 
        0 0 10px rgba(245, 254, 66, 0.8),
        0 0 20px rgba(245, 254, 66, 0.6),
        2px 2px 4px rgba(0, 0, 0, 0.5);
}

.score-popup.combo-4 {
    color: #f50057;
    text-shadow: 
        0 0 10px rgba(245, 0, 87, 0.8),
        0 0 20px rgba(245, 0, 87, 0.6),
        0 0 30px rgba(245, 0, 87, 0.4),
        2px 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes scorePopup {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    70% {
        opacity: 1;
        transform: translate(-50%, -55%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -65%) scale(0.9);
    }
}

@keyframes scoreItemAppear {
    0% {
        opacity: 0;
        transform: translateX(-10px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes scoreTotalAppear {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 里程碑奖励分数样式 */
.score-popup.milestone-bonus {
    font-size: 48px;
}

.score-popup.milestone-bonus.show {
    display: block;
    animation: milestoneScorePopup 0.95s ease-out forwards;
}

.score-popup.milestone-bonus .score-item,
.score-popup.milestone-bonus .score-total {
    background: linear-gradient(45deg, #ff0080, #ff8c00, #ffd700, #ff0080);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: milestoneScoreGradient 2s ease-in-out infinite;
    text-shadow: none;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 1))
            drop-shadow(0 0 30px rgba(255, 140, 0, 0.8))
            drop-shadow(0 0 45px rgba(255, 0, 128, 0.6));
}

.score-popup .milestone-score {
    font-size: 56px;
    animation: milestoneBounce 0.6s ease-out forwards, milestoneScoreGradient 2s ease-in-out infinite 0.6s;
}

@keyframes milestoneScorePopup {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.15);
    }
    85% {
        opacity: 1;
        transform: translate(-50%, -52%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -60%) scale(0.9);
    }
}

@keyframes milestoneScoreGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes milestoneBounce {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.3);
    }
    70% {
        transform: scale(0.9);
    }
    85% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Combo容器 */
.combo-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 50;
    pointer-events: none;
    min-width: 150px;
}

/* Combo指示器 */
.combo-indicator {
    padding: 8px 16px;
    border-radius: 10px 10px 0 0;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 2px;
    text-align: center;
    animation: comboPulse 0.6s ease-in-out infinite;
    background: transparent;
}

.combo-indicator.combo-low {
    color: #4CAF50;
    text-shadow: 
        0 0 8px rgba(76, 175, 80, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.5);
}

.combo-indicator.combo-medium {
    color: #2196F3;
    text-shadow: 
        0 0 10px rgba(33, 150, 243, 0.9),
        0 2px 4px rgba(0, 0, 0, 0.5);
}

.combo-indicator.combo-high {
    color: #FF9800;
    text-shadow: 
        0 0 12px rgba(255, 152, 0, 1),
        0 2px 4px rgba(0, 0, 0, 0.5);
}

.combo-indicator.combo-max {
    background: linear-gradient(45deg, #F44336, #E91E63, #9C27B0, #F44336);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: comboPulse 0.6s ease-in-out infinite, comboRainbow 2s ease infinite;
    text-shadow: none;
    filter: drop-shadow(0 0 15px rgba(244, 67, 54, 0.8))
            drop-shadow(0 0 25px rgba(233, 30, 99, 0.6))
            drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Combo x20+ - 传说级 */
.combo-indicator.combo-legendary {
    font-size: 24px;
    background: linear-gradient(45deg, #FFD700, #FFA500, #FF6347, #FFD700);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: comboPulse 0.5s ease-in-out infinite, comboRainbow 1.5s ease infinite;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 1))
            drop-shadow(0 0 30px rgba(255, 165, 0, 0.8))
            drop-shadow(0 0 40px rgba(255, 99, 71, 0.6))
            drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Combo x30+ - 神级 */
.combo-indicator.combo-godlike {
    font-size: 26px;
    background: linear-gradient(45deg, #00FFFF, #00FF00, #FFFF00, #FF00FF, #00FFFF);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: comboPulse 0.4s ease-in-out infinite, comboRainbow 1s ease infinite;
    text-shadow: none;
    filter: drop-shadow(0 0 25px rgba(0, 255, 255, 1))
            drop-shadow(0 0 35px rgba(0, 255, 0, 0.8))
            drop-shadow(0 0 45px rgba(255, 0, 255, 0.6))
            drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Combo x50+ - 超神级 */
.combo-indicator.combo-insane {
    font-size: 28px;
    background: linear-gradient(45deg, #FF0000, #FF7F00, #FFFF00, #00FF00, #0000FF, #4B0082, #9400D3, #FF0000);
    background-size: 500% 500%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: comboPulseStrong 0.3s ease-in-out infinite, comboRainbow 0.8s ease infinite, comboShake 0.5s ease-in-out infinite;
    text-shadow: none;
    filter: drop-shadow(0 0 30px rgba(255, 0, 0, 1))
            drop-shadow(0 0 40px rgba(255, 255, 0, 1))
            drop-shadow(0 0 50px rgba(0, 255, 0, 0.8))
            drop-shadow(0 0 60px rgba(0, 0, 255, 0.6))
            drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

@keyframes comboPulseStrong {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

@keyframes comboShake {
    0%, 100% {
        transform: translateX(0) rotate(0deg);
    }
    25% {
        transform: translateX(-2px) rotate(-1deg);
    }
    75% {
        transform: translateX(2px) rotate(1deg);
    }
}

@keyframes comboPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes comboRainbow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Combo倒计时进度条 */
.combo-timer {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    border-radius: 4px;
}

.combo-timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #4CAF50, #81C784);
    transition: width 0.1s linear, background 0.3s ease;
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}

/* Combo倒计时文字 */
.combo-time-text {
    text-align: center;
    padding: 4px 8px;
    background: transparent;
    border-radius: 0 0 10px 10px;
    font-size: 16px;
    font-weight: 900;
    color: #4CAF50;
    text-shadow: 
        0 0 5px rgba(76, 175, 80, 0.6),
        0 2px 4px rgba(0, 0, 0, 0.5);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

/* 分数弹窗中的combo倍数文字 */
.combo-multiplier-text {
    font-size: 24px;
    font-weight: 900;
    margin-top: 5px;
    animation: comboMultiplierAppear 0.4s ease-out forwards;
    opacity: 0;
}

@keyframes comboMultiplierAppear {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* 有combo的分数弹窗增强效果 */
.score-popup.has-combo {
    filter: drop-shadow(0 0 20px rgba(255, 140, 0, 0.6));
}

/* ==================== 移动端专属元素 ==================== */
/* 桌面端隐藏 */
.desktop-only {
    display: flex;
}

/* 移动端顶部信息栏 */
.mobile-top-bar {
    display: none;
}

/* 移动端游戏区域容器 */
.game-area-container {
    position: relative;
}

/* 移动端下一个方块预览 */
.mobile-next-piece {
    display: none;
}

/* ==================== 移动端虚拟控制按钮（紧凑版） ==================== */
.mobile-controls {
    display: none; /* 默认隐藏，只在移动端显示 */
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    padding: 0 10px;
}

.mobile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    max-width: 80px;
    height: 55px;
    padding: 8px;
    background: rgba(0, 255, 136, 0.1);
    border: 2px solid #00ff88;
    border-radius: 10px;
    color: #00ff88;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 
        0 0 10px rgba(0, 255, 136, 0.2),
        inset 0 0 10px rgba(0, 255, 136, 0.05);
}

.mobile-btn svg {
    width: 32px;
    height: 32px;
    stroke-width: 2.5;
    filter: drop-shadow(0 0 3px rgba(0, 255, 136, 0.6));
}

.mobile-btn:active {
    background: rgba(0, 255, 136, 0.3);
    transform: scale(0.92);
    box-shadow: 
        0 0 20px rgba(0, 255, 136, 0.5),
        inset 0 0 15px rgba(0, 255, 136, 0.15);
}

/* 旋转按钮特殊样式 */
.mobile-btn-rotate {
    border-color: #00ddff;
    background: rgba(0, 221, 255, 0.1);
    box-shadow: 
        0 0 10px rgba(0, 221, 255, 0.2),
        inset 0 0 10px rgba(0, 221, 255, 0.05);
}

.mobile-btn-rotate svg {
    filter: drop-shadow(0 0 3px rgba(0, 221, 255, 0.6));
}

.mobile-btn-rotate:active {
    background: rgba(0, 221, 255, 0.3);
    box-shadow: 
        0 0 20px rgba(0, 221, 255, 0.5),
        inset 0 0 15px rgba(0, 221, 255, 0.15);
}

/* ==================== 移动端菜单面板 ==================== */
.mobile-menu-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
}

.mobile-menu-panel.active {
    display: block;
}

.mobile-menu-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.mobile-menu-content {
    position: absolute;
    right: 0;
    top: 0;
    width: 80%;
    max-width: 320px;
    height: 100%;
    background: linear-gradient(135deg, #1a1f3a 0%, #0f1425 100%);
    border-left: 2px solid #00ff88;
    box-shadow: -5px 0 30px rgba(0, 255, 136, 0.3);
    overflow-y: auto;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 2px solid rgba(0, 255, 136, 0.2);
    background: rgba(0, 255, 136, 0.05);
}

.mobile-menu-header h3 {
    color: #00ff88;
    font-size: 18px;
    margin: 0;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.mobile-menu-close {
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 32px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.mobile-menu-close:active {
    background: rgba(255, 107, 107, 0.2);
    transform: rotate(90deg);
}

.mobile-menu-body {
    padding: 15px;
}

.mobile-menu-section {
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(0, 20, 40, 0.6);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 8px;
}

.mobile-menu-section h4 {
    color: #00ddff;
    font-size: 14px;
    margin: 0 0 10px 0;
    text-shadow: 0 0 5px rgba(0, 221, 255, 0.5);
}

.mobile-menu-section .audio-toggle-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 移动端音频按钮横向排列 */
.mobile-menu-section .audio-toggle-group.mobile-audio-row {
    flex-direction: row;
    gap: 10px;
}

.mobile-menu-section .audio-toggle-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    font-size: 13px;
}

/* 横向排列时的样式调整 */
.mobile-menu-section .mobile-audio-row .audio-toggle-btn {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    font-size: 12px;
}

.mobile-menu-section .audio-toggle-btn .icon {
    width: 20px;
    height: 20px;
}

.mobile-menu-section .mobile-audio-row .audio-toggle-btn .icon {
    width: 24px;
    height: 24px;
}

.mobile-instructions p,
.mobile-rules p {
    color: #00ff88;
    font-size: 12px;
    line-height: 1.8;
    margin: 5px 0;
    padding-left: 5px;
}

/* 移动端版本信息 */
.mobile-footer {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 255, 136, 0.2);
    text-align: center;
}

.mobile-footer p {
    color: #00ff88;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    margin: 8px 0;
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.5);
}

.mobile-footer a {
    color: #00ddff;
    text-decoration: none;
    font-weight: 700;
    text-shadow: 0 0 5px rgba(0, 221, 255, 0.5);
    transition: all 0.3s ease;
}

.mobile-footer a:active {
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

.mobile-footer .version {
    color: #888;
    font-size: 11px;
    opacity: 0.8;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .game-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .info-panel,
    .control-panel {
        width: 100%;
        max-width: 340px;
    }
    
    .control-panel {
        order: 3; /* 放到最后 */
    }
    
    .info-panel {
        order: 1;
    }
    
    .game-area {
        order: 2;
    }
}

@media (max-width: 768px) {
    body {
        height: 100dvh; /* 使用 dvh 考虑浏览器工具栏 */
        min-height: -webkit-fill-available; /* Safari 兼容 */
        overflow: hidden;
        align-items: center;
        justify-content: center;
    }
    
    .container {
        padding: 5px;
        max-width: 100%;
        height: 100dvh;
        min-height: -webkit-fill-available;
        display: flex;
        flex-direction: column;
    }
    
    .header {
        margin-bottom: 4px;
        padding: 3px 0;
        flex-shrink: 0;
    }
    
    .header h1 {
        font-size: 14px;
        letter-spacing: 1.5px;
    }
    
    .game-wrapper {
        gap: 5px;
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
    }

    /* 隐藏桌面端元素 */
    .desktop-only {
        display: none !important;
    }
    
    /* 显示移动端顶部信息栏 */
    .mobile-top-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 4px;
        padding: 4px;
        background: rgba(0, 20, 40, 0.8);
        border: 2px solid #00ff88;
        border-radius: 6px;
        box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
        flex-shrink: 0;
    }
    
    .mobile-info-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 3px;
        flex: 1;
    }
    
    .mobile-info-item {
        background: rgba(0, 0, 0, 0.3);
        padding: 3px 2px;
        border-radius: 4px;
        text-align: center;
        border: 1px solid rgba(0, 255, 136, 0.2);
    }
    
    .mobile-info-label {
        font-size: 8px;
        color: #00ddff;
        margin-bottom: 1px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }
    
    .mobile-info-value {
        font-size: 14px;
        font-weight: 700;
        color: #00ff88;
        font-family: 'Courier New', monospace;
        text-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
    }
    
    /* 菜单按钮 */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 100%;
        min-height: 54px;
        background: rgba(0, 221, 255, 0.1);
        border: 2px solid #00ddff;
        border-radius: 4px;
        color: #00ddff;
        cursor: pointer;
        flex-shrink: 0;
        box-shadow: 0 0 10px rgba(0, 221, 255, 0.2);
    }
    
    .mobile-menu-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .mobile-menu-btn:active {
        background: rgba(0, 221, 255, 0.3);
        transform: scale(0.95);
    }
    
    /* 游戏区域容器 */
    .game-area-container {
        position: relative;
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
        min-height: 0;
    }
    
    /* 游戏区域适配 */
    .game-area {
        padding: 5px;
        width: auto;
        max-width: 100%;
        position: relative;
    }

    #gameCanvas {
        width: auto !important;
        height: auto !important;
        max-width: calc(100vw - 20px);
        max-height: calc(100dvh - 120px); /* 使用 dvh 并减小高度 */
        aspect-ratio: 1/2;
    }
    
    /* 移动端预览显示（在顶部信息栏） */
    .mobile-next-piece {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.3);
        padding: 3px;
        border-radius: 4px;
        border: 2px solid #f5fe42;
        box-shadow: 0 0 8px rgba(245, 254, 66, 0.3);
        flex-shrink: 0;
    }
    
    .mobile-next-label {
        font-size: 7px;
        color: #f5fe42;
        margin-bottom: 1px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        font-weight: 700;
        text-shadow: 0 0 5px rgba(245, 254, 66, 0.5);
    }
    
    #mobileNextPieceCanvas {
        display: block;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 3px;
        width: 54px;
        height: 54px;
    }
    
    /* 隐藏移动端控制按钮 */
    .mobile-controls {
        display: none !important;
    }
    
    /* 模态框适配 */
    .login-content,
    .leaderboard-content {
        width: 95%;
        max-width: 95%;
    }
    
    .login-content {
        padding: 20px;
    }
    
    .login-header h2 {
        font-size: 20px;
    }
    
    .login-subtitle {
        font-size: 12px;
    }
    
    .leaderboard-header {
        padding: 15px;
    }
    
    .leaderboard-header h2 {
        font-size: 20px;
    }
    
    .leaderboard-body {
        padding: 15px;
    }
    
    /* 按钮适配 */
    .btn {
        padding: 10px 20px;
        font-size: 12px;
    }
    
    /* 组合动画文字大小调整 */
    .combo-text {
        font-size: 24px;
    }
    
    .combo-text.combo-4 {
        font-size: 28px;
    }
    
    .combo-text.level-up-text {
        font-size: 32px;
    }
    
    .combo-text.milestone-text {
        font-size: 36px;
    }
    
    .score-popup {
        font-size: 18px;
    }
    
    .score-popup .score-total {
        font-size: 22px;
    }
    
    .score-popup.milestone-bonus {
        font-size: 28px;
    }
    
    .score-popup .milestone-score {
        font-size: 32px;
    }
    
    /* Combo容器移动端适配 */
    .combo-container {
        top: 5px;
        right: 5px;
        min-width: 100px;
    }
    
    .combo-indicator {
        font-size: 16px;
        padding: 6px 10px;
    }
    
    /* 高级Combo移动端字体 */
    .combo-indicator.combo-legendary {
        font-size: 18px;
    }
    
    .combo-indicator.combo-godlike {
        font-size: 20px;
    }
    
    .combo-indicator.combo-insane {
        font-size: 22px;
    }
    
    .combo-time-text {
        font-size: 14px;
        padding: 3px 6px;
    }
    
    .combo-timer {
        height: 6px;
    }
    
    .combo-multiplier-text {
        font-size: 18px;
    }
    
    /* 移动端显示操作提示 */
    .mobile-tips {
        display: block;
    }
    
    /* 游戏遮罩内容压缩 */
    .overlay-content {
        padding: 20px;
    }
    
    .mobile-tips {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .mobile-tips h4 {
        margin-bottom: 10px !important;
        font-size: 14px !important;
    }
    
    .mobile-tips p {
        margin: 3px 0 !important;
        font-size: 12px !important;
        line-height: 1.6 !important;
    }
}

/* 超小屏幕适配 */
@media (max-width: 480px) {
    .header h1 {
        font-size: 13px;
        letter-spacing: 0.8px;
    }
    
    .mobile-info-label {
        font-size: 7px;
    }
    
    .mobile-info-value {
        font-size: 12px;
    }
    
    .mobile-next-label {
        font-size: 6px;
    }
    
    #mobileNextPieceCanvas {
        width: 48px !important;
        height: 48px !important;
    }
    
    .mobile-btn {
        max-width: 70px;
        height: 50px;
    }
    
    .mobile-btn svg {
        width: 28px;
        height: 28px;
    }
    
    .mobile-tips h4 {
        font-size: 13px !important;
    }
    
    .mobile-tips p {
        font-size: 11px !important;
    }
}

/* 针对短屏幕的额外优化 */
@media (max-height: 700px) {
    .header h1 {
        font-size: 12px;
    }
    
    .mobile-info-value {
        font-size: 12px;
    }
    
    .mobile-tips {
        padding: 8px;
        margin-bottom: 12px;
    }
    
    .mobile-tips h4 {
        font-size: 13px !important;
        margin-bottom: 8px !important;
    }
    
    .mobile-tips p {
        font-size: 11px !important;
        line-height: 1.5 !important;
    }
}

@media (max-height: 650px) {
    .container {
        padding: 3px;
    }
    
    .header {
        margin-bottom: 2px;
        padding: 2px 0;
    }
    
    .header h1 {
        font-size: 11px;
    }
    
    .game-wrapper {
        gap: 3px;
    }
    
    .mobile-top-bar {
        padding: 3px;
        gap: 3px;
    }
    
    .mobile-info-item {
        padding: 2px 1px;
    }
    
    .mobile-info-value {
        font-size: 11px;
    }
    
    #mobileNextPieceCanvas {
        width: 45px !important;
        height: 45px !important;
    }
}

/* ==================== 移动端额外优化 ==================== */
/* 虚拟键盘弹出时的布局调整 */
body.keyboard-open {
    height: 100vh;
    overflow: hidden;
}

body.keyboard-open .container {
    height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 低性能设备优化 - 禁用部分动画 */
.low-performance * {
    animation-duration: 0.1s !important;
    transition-duration: 0.1s !important;
}

.low-performance .combo-text,
.low-performance .score-popup {
    animation: none !important;
    opacity: 0 !important;
}

/* 触摸优化 */
.mobile-btn,
button,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
}

input,
textarea {
    user-select: text;
    -webkit-user-select: text;
}

/* ==================== 登录模态框 ==================== */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.login-modal.hidden {
    display: none;
}

.login-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.login-content {
    position: relative;
    background: linear-gradient(135deg, #1a1f3a 0%, #0f1425 100%);
    border: 2px solid #00ff88;
    border-radius: 15px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    max-height: 90vh; /* 限制最大高度 */
    overflow-y: auto; /* 允许滚动 */
    box-shadow: 
        0 0 30px rgba(0, 255, 136, 0.3),
        inset 0 0 30px rgba(0, 255, 136, 0.05);
    animation: slideDown 0.4s ease;
    /* 允许模态框滚动 */
    touch-action: pan-y; /* 允许垂直滚动 */
    -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header h2 {
    color: #00ff88;
    font-size: 24px;
    margin-bottom: 10px;
    text-align: center;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.login-subtitle {
    color: #00ddff;
    font-size: 14px;
    text-align: center;
    margin-bottom: 20px;
    opacity: 0.8;
}

.login-body {
    margin: 20px 0;
}

.login-notice {
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 8px;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: #00ff88;
    font-size: 13px;
    text-align: center;
}

.login-notice.success {
    background: rgba(0, 255, 136, 0.15);
    border-color: #00ff88;
    color: #00ff88;
}

.login-notice.warning {
    background: rgba(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.5);
    color: #ffc107;
}

.login-notice.error {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.5);
    color: #ff6b6b;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: #00ddff;
    font-size: 13px;
    font-weight: bold;
}

.form-group input {
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 255, 136, 0.3);
    border-radius: 8px;
    color: #00ff88;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.form-group input::placeholder {
    color: rgba(0, 255, 136, 0.4);
}

.btn-large {
    padding: 15px 30px;
    font-size: 16px;
    font-weight: bold;
}

.login-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 255, 136, 0.2);
    text-align: center;
}

.login-footer p {
    color: #00ddff;
    font-size: 12px;
    opacity: 0.7;
}

/* ==================== 排行榜模态框 ==================== */
.leaderboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.leaderboard-modal.hidden {
    display: none;
}

.leaderboard-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.leaderboard-content {
    position: relative;
    background: linear-gradient(135deg, #1a1f3a 0%, #0f1425 100%);
    border: 2px solid #00ff88;
    border-radius: 15px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 
        0 0 30px rgba(0, 255, 136, 0.3),
        inset 0 0 30px rgba(0, 255, 136, 0.05);
    animation: slideDown 0.4s ease;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid rgba(0, 255, 136, 0.2);
}

.leaderboard-header h2 {
    color: #00ff88;
    font-size: 24px;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.close-btn {
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 107, 107, 0.1);
    transform: rotate(90deg);
}

.leaderboard-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    /* 允许排行榜滚动 */
    touch-action: pan-y; /* 允许垂直滚动 */
    -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
}

/* 滚动条样式 */
.leaderboard-body::-webkit-scrollbar {
    width: 8px;
}

.leaderboard-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.leaderboard-body::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 10px;
}

.leaderboard-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 136, 0.5);
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #00ff88;
    font-size: 16px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #00ddff;
}

.empty-state p {
    margin: 10px 0;
    font-size: 18px;
}

.empty-hint {
    font-size: 14px !important;
    opacity: 0.7;
}

.offline-notice {
    background: rgba(255, 193, 7, 0.1);
    border: 2px solid rgba(255, 193, 7, 0.5);
    padding: 12px;
    border-radius: 8px;
    color: #ffc107;
    text-align: center;
    margin-bottom: 20px;
    font-size: 13px;
}

.user-rank-card {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.15) 0%, rgba(0, 221, 255, 0.1) 100%);
    border: 2px solid #00ff88;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 25px;
}

.user-rank-card h3 {
    color: #00ddff;
    font-size: 14px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.rank-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.rank-number {
    font-size: 32px;
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.rank-details {
    flex: 1;
}

.rank-name {
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.rank-score {
    color: #f5fe42;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 3px;
}

.rank-meta {
    color: #00ddff;
    font-size: 12px;
    opacity: 0.8;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.leaderboard-item:hover {
    background: rgba(0, 255, 136, 0.05);
    border-color: rgba(0, 255, 136, 0.4);
    transform: translateX(5px);
}

.leaderboard-item.current-user {
    background: rgba(0, 255, 136, 0.1);
    border: 2px solid #00ff88;
}

.leaderboard-item.rank-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 193, 7, 0.05) 100%);
    border-color: #ffd700;
}

.leaderboard-item.rank-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.1) 0%, rgba(169, 169, 169, 0.05) 100%);
    border-color: #c0c0c0;
}

.leaderboard-item.rank-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.1) 0%, rgba(184, 115, 51, 0.05) 100%);
    border-color: #cd7f32;
}

.rank-badge {
    font-size: 20px;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
    color: #00ff88;
}

.rank-1 .rank-badge {
    color: #ffd700;
    font-size: 24px;
}

.rank-2 .rank-badge {
    color: #c0c0c0;
    font-size: 24px;
}

.rank-3 .rank-badge {
    color: #cd7f32;
    font-size: 24px;
}

.player-info {
    flex: 1;
    min-width: 0;
}

.player-name {
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-you {
    display: inline-block;
    background: #00ff88;
    color: #0a0e27;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
}

.player-meta {
    color: #00ddff;
    font-size: 11px;
    opacity: 0.7;
    display: flex;
    gap: 5px;
}

.player-score {
    color: #f5fe42;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(245, 254, 66, 0.3);
}

.leaderboard-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 20px 25px;
    border-top: 2px solid rgba(0, 255, 136, 0.2);
}

.leaderboard-footer .btn {
    flex: 1;
}


/* 里程碑飘浮动画 */
.milestone-float-bonus {
    white-space: nowrap;
}

@keyframes milestoneFloatUp {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -60%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -80%) scale(0.8);
    }
}

/* ==================== 程序员节祝福弹窗 ==================== */
.programmer-day-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10002;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.programmer-day-modal.hidden {
    display: none;
}

.programmer-day-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.programmer-day-content {
    position: relative;
    background: linear-gradient(135deg, #1a1f3a 0%, #0f1425 100%);
    border: 2px solid #00ff88;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 
        0 0 30px rgba(0, 255, 136, 0.3),
        inset 0 0 30px rgba(0, 255, 136, 0.05);
    animation: slideDown 0.4s ease;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.programmer-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(0, 255, 136, 0.2);
}

.programmer-day-header h2 {
    color: #00ff88;
    font-size: 24px;
    text-align: center;
    flex: 1;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
    margin: 0;
}

.programmer-day-body {
    text-align: center;
}

.programmer-day-greeting {
    color: #00ddff;
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(0, 221, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(0, 221, 255, 0.3);
}

.qrcode-section {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid rgba(0, 255, 136, 0.3);
}

.qrcode-section h3 {
    color: #f5fe42;
    font-size: 16px;
    margin-bottom: 15px;
    text-shadow: 0 0 5px rgba(245, 254, 66, 0.5);
}

.qrcode-image {
    width: 200px;
    height: 200px;
    margin: 15px auto;
    display: block;
    border: 3px solid #00ff88;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    background: white;
    padding: 5px;
}

.qrcode-hint {
    color: #00ff88;
    font-size: 13px;
    margin-top: 10px;
    opacity: 0.8;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .programmer-day-content {
        padding: 20px;
        max-width: 95%;
    }
    
    .programmer-day-header h2 {
        font-size: 20px;
    }
    
    .programmer-day-greeting {
        font-size: 14px;
        padding: 12px;
    }
    
    .qrcode-section {
        padding: 15px;
    }
    
    .qrcode-section h3 {
        font-size: 14px;
    }
    
    .qrcode-image {
        width: 180px;
        height: 180px;
    }
    
    .qrcode-hint {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .qrcode-image {
        width: 160px;
        height: 160px;
    }
}
