
/* tetris_game/frontend/style.css */
/* 基础样式 */
body {
    font-family: 'Press Start 2P', cursive;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* 游戏容器 */
.game-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 2rem;
    margin: 0 auto;
    padding: 1rem;
}

/* 游戏画布 */
canvas {
    border: 4px solid #4cc9f0;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(76, 201, 240, 0.6);
    background-color: rgba(0, 0, 0, 0.5);
    max-width: 100%;
    height: auto;
}

/* 游戏控制按钮 */
.btn {
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    text-align: center;
    border: none;
    cursor: pointer;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
    filter: brightness(1.1);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
    filter: brightness(0.9);
}

/* 触摸控制区域 */
.touch-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 300px;
    margin: 1rem auto;
    user-select: none;
}

.touch-btn {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(76, 201, 240, 0.2);
    border: 2px solid rgba(76, 201, 240, 0.6);
    border-radius: 12px;
    touch-action: manipulation;
    user-select: none;
    transition: all 0.15s ease;
    color: white;
    text-shadow: 0 0 5px rgba(76, 201, 240, 0.8);
}

.touch-btn:active {
    background: rgba(76, 201, 240, 0.4);
    transform: scale(0.95);
}

.control-center {
    grid-column: 2;
}

/* 粒子背景 */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* 游戏信息面板 */
.game-info {
    background-color: rgba(22, 33, 62, 0.7);
    border: 1px solid rgba(76, 201, 240, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

.game-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
}

/* 标题样式 */
h1, h2, h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #4cc9f0, #b5179e);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 10px rgba(76, 201, 240, 0.3);
}

h1 {
    font-size: 2.5rem;
    letter-spacing: 2px;
    padding: 1rem;
}

/* 响应式布局 */
@media (max-width: 991px) {
    .game-container {
        flex-direction: column;
        align-items: center;
    }
    
    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    body {
        padding-bottom: 2rem;
    }
    
    canvas {
        width: 90vw;
        max-width: 350px;
        height: auto;
    }
    
    .game-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .touch-controls {
        margin-top: 20px;
        width: 90vw;
        max-width: 300px;
    }
    
    h1 {
        font-size: 1.5rem;
        margin: 0.5rem 0;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.7rem;
    }
    
    .game-info {
        width: 90vw;
        max-width: 350px;
    }
}

@media (max-width: 480px) {
    .touch-btn {
        height: 50px;
        font-size: 20px;
    }
    
    .btn {
        font-size: 0.6rem;
        padding: 0.4rem 0.8rem;
    }
}

/* 动画效果 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pulse {
    animation: pulse 2s infinite;
}

.fadeIn {
    animation: fadeIn 0.5s;
}

/* 优化触摸控制按钮外观 */
#touchLeft, #touchRight {
    font-size: 28px;
}

#touchRotate {
    background: rgba(181, 23, 158, 0.2);
    border-color: rgba(181, 23, 158, 0.6);
}

#touchDrop {
    background: rgba(252, 163, 17, 0.2);
    border-color: rgba(252, 163, 17, 0.6);
}

#touchPause {
    background: rgba(229, 80, 57, 0.2);
    border-color: rgba(229, 80, 57, 0.6);
}

#touchStart {
    background: rgba(39, 174, 96, 0.2);
    border-color: rgba(39, 174, 96, 0.6);
}

/* 特殊效果 */
.glow {
    box-shadow: 0 0 10px rgba(76, 201, 240, 0.8);
}

/* 适配暗黑模式 */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #0f0f1f 0%, #111129 100%);
    }
    
    canvas {
        border-color: #3da8cc;
        box-shadow: 0 0 20px rgba(61, 168, 204, 0.4);
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(22, 33, 62, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgba(76, 201, 240, 0.6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 201, 240, 0.8);
}
