/* 全局樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft JhengHei', 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ecf0f1;
    padding: 20px;
}

.container {
    max-width: 1400px;
    width: 100%;
}

/* 頂部標題 */
.header {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 0.8s ease-out;
}

.header h1 {
    font-size: 3em;
    color: #00d2d3;
    text-shadow: 0 0 20px rgba(0, 210, 211, 0.5);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.title-icon {
    vertical-align: middle;
}

.icon {
    vertical-align: middle;
    display: inline-block;
}

.icon-small {
    vertical-align: middle;
    display: inline-block;
    margin-right: 8px;
}

.info-box h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #feca57;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.stat-label {
    font-size: 1.1em;
    color: #ecf0f1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-item {
    padding: 10px;
    margin: 5px 0;
    background: rgba(15, 52, 96, 0.5);
    border-radius: 8px;
    border-left: 4px solid #00d2d3;
    font-size: 1em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn {
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Microsoft JhengHei', sans-serif;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.game-over h2 {
    font-size: 2.5em;
    color: #ff6b6b;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.subtitle {
    font-size: 1.2em;
    color: #feca57;
    opacity: 0.9;
}

/* 遊戲主區域 */
.game-wrapper {
    display: flex;
    justify-content: center;
    gap: 30px;
    align-items: flex-start;
    animation: fadeIn 1s ease-out;
}

/* 側邊面板 */
.left-panel,
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 280px;
}

/* 信息卡片 */
.info-box {
    background: rgba(22, 33, 62, 0.8);
    border: 3px solid #0f3460;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.info-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 210, 211, 0.3);
    border-color: #00d2d3;
}

.info-box h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #feca57;
    text-align: center;
}

/* 下一個方塊預覽 */
.next-piece-box canvas {
    display: block;
    margin: 0 auto;
    background: #0f3460;
    border-radius: 10px;
}

/* 統計數據 */
.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 2px solid rgba(15, 52, 96, 0.5);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 1.1em;
    color: #ecf0f1;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #00d2d3;
    text-shadow: 0 0 10px rgba(0, 210, 211, 0.5);
    font-family: 'Consolas', monospace;
}

#highScore {
    font-size: 2.5em;
    text-align: center;
    color: #feca57;
}

/* 操作說明 */
.control-item {
    padding: 10px;
    margin: 5px 0;
    background: rgba(15, 52, 96, 0.5);
    border-radius: 8px;
    border-left: 4px solid #00d2d3;
    font-size: 1em;
    transition: all 0.3s ease;
}

.control-item:hover {
    background: rgba(0, 210, 211, 0.2);
    transform: translateX(5px);
}

/* 遊戲畫布區域 */
.game-canvas-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    background: #16213e;
    border: 5px solid #00d2d3;
    border-radius: 15px;
    box-shadow: 0 0 40px rgba(0, 210, 211, 0.5),
                0 0 80px rgba(0, 210, 211, 0.3);
    display: block;
}

/* 遊戲結束覆蓋層 */
.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(26, 26, 46, 0.95);
    border: 4px solid #ff6b6b;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 0 60px rgba(255, 107, 107, 0.5);
    z-index: 100;
    animation: scaleIn 0.5s ease-out;
}

.game-over.hidden {
    display: none;
}

.game-over h2 {
    font-size: 2.5em;
    color: #ff6b6b;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.game-over p {
    font-size: 1.5em;
    margin-bottom: 30px;
    color: #ecf0f1;
}

#finalScore {
    color: #feca57;
    font-weight: bold;
    font-size: 1.3em;
}

/* 按鈕樣式 */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn {
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Microsoft JhengHei', sans-serif;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.btn:active {
    transform: translateY(-1px);
}

.btn-pause {
    background: linear-gradient(135deg, #feca57 0%, #ff9f43 100%);
    color: #1a1a2e;
}

.btn-pause:hover {
    background: linear-gradient(135deg, #ff9f43 0%, #feca57 100%);
}

.btn-restart {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
}

.btn-restart:hover {
    background: linear-gradient(135deg, #ee5a52 0%, #ff6b6b 100%);
}

/* 頁腳 */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    opacity: 0.8;
    animation: fadeInUp 1s ease-out;
}

.footer p {
    margin: 5px 0;
    color: #ecf0f1;
}

.hint {
    color: #feca57;
    font-size: 0.9em;
}

/* 動畫 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 響應式設計 */
@media (max-width: 1200px) {
    .game-wrapper {
        flex-wrap: wrap;
    }
    
    .left-panel,
    .right-panel {
        width: 100%;
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2em;
    }
    
    .subtitle {
        font-size: 1em;
    }
    
    #gameCanvas {
        width: 280px;
        height: 560px;
    }
    
    .info-box {
        padding: 15px;
    }
}
