* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Orbitron', sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a2e 50%, #16213e 100%);
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* 動態背景 */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(120, 0, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(255, 0, 128, 0.1) 0%, transparent 50%);
    animation: backgroundPulse 10s ease-in-out infinite;
    z-index: -1;
}

@keyframes backgroundPulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 0.8;
    }
}

/* 主容器 */
.game-container {
    width: 100%;
    max-width: 1000px;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 標題 */
.game-header {
    text-align: center;
    padding: 10px;
}

.game-title {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: 6px;
    text-transform: uppercase;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.title-3d {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.5));
    animation: glow3D 2s ease-in-out infinite;
}

.title-tetris {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(245, 87, 108, 0.5));
    animation: glowTetris 2s ease-in-out infinite;
}

@keyframes glow3D {

    0%,
    100% {
        filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.5));
    }

    50% {
        filter: drop-shadow(0 0 30px rgba(102, 126, 234, 0.8));
    }
}

@keyframes glowTetris {

    0%,
    100% {
        filter: drop-shadow(0 0 20px rgba(245, 87, 108, 0.5));
    }

    50% {
        filter: drop-shadow(0 0 30px rgba(245, 87, 108, 0.8));
    }
}

/* 主要內容區 */
.main-content {
    display: flex;
    gap: 15px;
    height: 600px;
    align-items: stretch;
}

/* 側邊面板 */
.side-panel {
    flex: 0 0 180px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 玻璃態卡片 */
.panel-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.panel-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.panel-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* 分數顯示 */
.score-display,
.level-display,
.lines-display {
    text-align: center;
}

.score-value,
.level-value,
.lines-value {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #00f5ff 0%, #00d4ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 15px rgba(0, 212, 255, 0.6));
}

/* 下一個方塊預覽 */
#next-piece-canvas {
    width: 100%;
    height: 120px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 控制說明 */
.controls-card {
    flex: 1;
}

.controls-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.key {
    font-weight: 700;
    color: #ff6b9d;
    background: rgba(255, 107, 157, 0.1);
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.75rem;
    border: 1px solid rgba(255, 107, 157, 0.3);
}

.action {
    font-size: 0.75rem;
    color: #a0a0a0;
}

/* 遊戲畫布 */
.game-canvas-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    box-shadow:
        0 0 50px rgba(102, 126, 234, 0.3),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
}

#game-canvas {
    width: 100%;
    height: 100%;
}

/* 遊戲覆蓋層 */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.game-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.overlay-content {
    text-align: center;
    animation: overlayPulse 2s ease-in-out infinite;
}

@keyframes overlayPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.overlay-title {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.6));
}

.overlay-subtitle {
    font-size: 1rem;
    color: #a0a0a0;
    letter-spacing: 1.5px;
}

/* 響應式設計 */
@media (max-width: 900px) {
    .game-title {
        font-size: 2rem;
    }

    .side-panel {
        flex: 0 0 150px;
    }
}

@media (max-width: 700px) {
    .main-content {
        flex-direction: column;
        height: auto;
    }

    .side-panel {
        flex-direction: row;
        flex: 0 0 auto;
    }

    .panel-card {
        flex: 1;
    }

    .game-canvas-wrapper {
        height: 500px;
    }
}