/**
 * 俄罗斯方块游戏样式
 * 现代化响应式设计，支持桌面端和移动端
 */

/* 主容器 */
.tetris-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    border-radius: 25px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
    overflow: hidden;
}

.tetris-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shine 3s infinite;
    z-index: 1;
}

@keyframes shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 游戏头部 */
.game-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.15) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.15) 100%);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 2;
}

.header-content h1 {
    font-size: 2.8rem;
    margin: 0 0 15px 0;
    font-weight: bold;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #f9ca24, #ff6b6b);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease-in-out infinite;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

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

.game-subtitle {
    font-size: 1.1rem;
    margin: 0;
    opacity: 0.9;
    font-weight: 300;
}

/* 统计信息容器 */
.stats-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.stat-box {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.2) 100%);
    border-radius: 15px;
    padding: 18px 22px;
    text-align: center;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-width: 90px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s;
}

.stat-box:hover::before {
    left: 100%;
}

.stat-box:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 12px 24px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.stat-box.best-score {
    background: linear-gradient(135deg, 
        rgba(255, 107, 107, 0.3) 0%,
        rgba(255, 142, 142, 0.2) 50%,
        rgba(255, 107, 107, 0.3) 100%);
    border: 2px solid rgba(255, 107, 107, 0.4);
    box-shadow: 
        0 8px 16px rgba(255, 107, 107, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: bestScoreGlow 2s ease-in-out infinite alternate;
}

@keyframes bestScoreGlow {
    from { box-shadow: 0 8px 16px rgba(255, 107, 107, 0.2); }
    to { box-shadow: 0 12px 24px rgba(255, 107, 107, 0.4); }
}

.stat-label {
    font-size: 0.9rem;
    margin-bottom: 5px;
    opacity: 0.8;
    font-weight: 500;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: bold;
    text-shadow: 
        0 0 10px rgba(255, 255, 255, 0.3),
        2px 2px 4px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 游戏控制按钮 */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.button {
    background: linear-gradient(135deg, #4ecdc4, #44a08d, #4ecdc4);
    background-size: 200% 200%;
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 6px 12px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    animation: buttonGradient 3s ease-in-out infinite;
}

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

.button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(78, 205, 196, 0.3);
    filter: brightness(1.1);
}

.button:active {
    transform: translateY(0);
}

.button.secondary {
    background: linear-gradient(45deg, #667eea, #764ba2);
}

.button.third {
    background: linear-gradient(45deg, #f093fb, #f5576c);
}

.button:disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 游戏主区域 */
.game-main {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
    margin: 30px 0;
    flex-wrap: wrap;
}

/* 游戏板容器 */
.game-board-wrapper {
    position: relative;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.15) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.15) 100%);
    border-radius: 20px;
    padding: 25px;
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 2;
}

.game-board {
    position: relative;
    margin: 0 auto;
}

/* 游戏侧边栏 */
.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 200px;
}

.next-piece-container,
.held-piece-container,
.level-progress {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.15) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.15) 100%);
    border-radius: 16px;
    padding: 22px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.next-piece-container h3,
.held-piece-container h3,
.level-progress h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.next-piece-preview,
.held-piece-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
}

/* 等级进度条 */
.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ecdc4, #44a08d, #4ecdc4);
    background-size: 200% 100%;
    border-radius: 6px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    animation: progressShine 2s ease-in-out infinite;
    box-shadow: 
        0 0 10px rgba(78, 205, 196, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

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

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 覆盖层样式 */
.game-over-overlay,
.pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    z-index: 10;
    animation: overlayFadeIn 0.4s ease-out;
}

@keyframes overlayFadeIn {
    from { opacity: 0; backdrop-filter: blur(0px); }
    to { opacity: 1; backdrop-filter: blur(15px); }
}

.game-over-content,
.pause-content {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.98) 0%,
        rgba(255, 255, 255, 0.95) 100%);
    color: #333;
    padding: 45px;
    border-radius: 25px;
    text-align: center;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    max-width: 420px;
    width: 90%;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: contentSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes contentSlideIn {
    from { 
        transform: translateY(30px) scale(0.9);
        opacity: 0;
    }
    to { 
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.game-over-content h2,
.pause-content h2 {
    margin: 0 0 20px 0;
    font-size: 2rem;
    color: #333;
}

.final-score,
.final-level,
.final-lines {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-weight: 600;
}

.new-record {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #ff6b6b);
    background-size: 200% 200%;
    color: white;
    padding: 15px;
    border-radius: 12px;
    margin: 18px 0;
    font-weight: bold;
    animation: recordPulse 2s infinite, recordGradient 3s ease-in-out infinite;
    box-shadow: 
        0 8px 20px rgba(255, 107, 107, 0.3),
        0 0 20px rgba(78, 205, 196, 0.2);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

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

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.game-over-buttons,
.win-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* 游戏说明 */
.game-instructions {
    margin-top: 40px;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.15) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.15) 100%);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 12px 30px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 2;
}

.game-instructions h3 {
    text-align: center;
    margin: 0 0 25px 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.15) 0%,
        rgba(255, 255, 255, 0.05) 100%);
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.instruction-item:hover {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.25) 0%,
        rgba(255, 255, 255, 0.15) 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.15),
        0 0 20px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.instruction-icon {
    font-size: 2rem;
    min-width: 50px;
    text-align: center;
}

.instruction-text {
    flex: 1;
    line-height: 1.6;
}

.instruction-text strong {
    display: block;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

/* 游戏技巧 */
.game-tips {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
}

.game-tips h4 {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
}

.game-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.game-tips li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    line-height: 1.6;
}

.game-tips li:before {
    content: "💡";
    position: absolute;
    left: 0;
    top: 8px;
}

/* 移动端控制按钮 */
.mobile-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border-radius: 15px;
    padding: 15px;
    backdrop-filter: blur(10px);
    z-index: 1000;
}

.mobile-controls-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 5px 0;
}

.mobile-btn {
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.25) 0%,
        rgba(255, 255, 255, 0.1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 15px;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.mobile-btn:hover,
.mobile-btn:active {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.35) 0%,
        rgba(255, 255, 255, 0.2) 100%);
    transform: scale(0.95);
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.3),
        0 0 15px rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .game-main {
        flex-direction: column;
        align-items: center;
    }
    
    .game-sidebar {
        flex-direction: row;
        justify-content: center;
        min-width: auto;
        width: 100%;
        max-width: 600px;
    }
    
    .instructions-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .tetris-container {
        padding: 15px;
        margin: 10px;
        border-radius: 15px;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .stats-container {
        gap: 10px;
    }
    
    .stat-box {
        padding: 10px 15px;
        min-width: 70px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .game-controls {
        gap: 10px;
    }
    
    .button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .game-board-wrapper {
        padding: 15px;
    }
    
    .instructions-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .instruction-item {
        padding: 15px;
    }
    
    .mobile-controls {
        display: block;
    }
}

@media (max-width: 480px) {
    .tetris-container {
        padding: 10px;
        margin: 5px;
    }
    
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .game-subtitle {
        font-size: 1rem;
    }
    
    .stats-container {
        gap: 8px;
    }
    
    .stat-box {
        padding: 8px 12px;
        min-width: 60px;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .button {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
    
    .game-board-wrapper {
        padding: 10px;
    }
    
    .game-sidebar {
        flex-direction: column;
        gap: 15px;
    }
    
    .next-piece-container,
    .held-piece-container,
    .level-progress {
        padding: 15px;
    }
    
    .game-over-content,
    .pause-content {
        padding: 25px;
    }
    
    .game-over-content h2,
    .pause-content h2 {
        font-size: 1.5rem;
    }
}

/* 游戏画布样式增强 */
canvas {
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.3),
        0 0 0 2px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    transition: all 0.3s ease;
}

canvas:hover {
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* 动画效果 */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(30px) scale(0.95);
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1);
    }
}

.tetris-container {
    animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}