/* 全域樣式 */
.hidden {
    display: none !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background-color: #000;
    color: #fff;
    overflow: hidden;
    user-select: none;
}

.game-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
}

/* 頂部面板 - 隱藏 */
.top-panel {
    display: none;
}

.game-title {
    font-size: 24px;
    color: #00d4ff;
    text-shadow: 0 0 10px #00d4ff;
}

.high-score {
    font-size: 18px;
    color: #ffaa00;
}

.pause-button {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.3s;
}

.pause-button:hover {
    background: #ff5252;
}

/* 主遊戲區域 */
.main-game-area {
    display: flex;
    flex: 1;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: radial-gradient(circle at center, #0a0a0a, #000);
}

/* 左側面板 */
.left-panel {
    width: 220px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #0f3460;
    border-radius: 8px;
    padding: 20px;
    height: fit-content;
    max-height: 90vh;
    overflow-y: auto;
}

.game-info {
    margin-bottom: 20px;
    text-align: center;
}

.game-info h2 {
    font-size: 16px;
    color: #00d4ff;
    text-shadow: 0 0 10px #00d4ff;
    margin-bottom: 10px;
}

.player-stats h3 {
    color: #00d4ff;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 1px solid #0f3460;
    padding-bottom: 8px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 5px 0;
}

.stat-label {
    color: #ccc;
}

.stat-value {
    color: #ffaa00;
    font-weight: bold;
}

/* Canvas 畫布 */
#game-canvas {
    border: 3px solid #00d4ff;
    border-radius: 8px;
    background: #000;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

/* 右側面板 */
.right-panel {
    width: 220px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #0f3460;
    border-radius: 8px;
    padding: 20px;
    height: fit-content;
    max-height: 90vh;
    overflow-y: auto;
}

.game-controls {
    margin-bottom: 20px;
    text-align: center;
}

.game-controls .pause-button {
    margin-bottom: 10px;
    width: 100%;
}

.game-controls .controls-info {
    font-size: 12px;
    color: #ccc;
    line-height: 1.4;
}

.powerups-display h3 {
    color: #00d4ff;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 1px solid #0f3460;
    padding-bottom: 8px;
}

.powerups-list {
    min-height: 100px;
}

.powerup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(15, 52, 96, 0.3);
    border-radius: 4px;
    border-left: 3px solid #ffaa00;
}

.powerup-item.active {
    background: rgba(255, 170, 0, 0.2);
    border-left-color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.powerup-name {
    color: #ccc;
    font-size: 12px;
}

.powerup-level {
    color: #ffaa00;
    font-weight: bold;
    font-size: 11px;
}

.powerup-timer {
    color: #ff6b6b;
    font-size: 10px;
}

/* 底部面板 - 隱藏 */
.bottom-panel {
    display: none;
}

.controls-info {
    color: #ccc;
    font-size: 14px;
}

.audio-controls {
    margin-top: 20px;
}

.audio-controls h3 {
    color: #00d4ff;
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 1px solid #0f3460;
    padding-bottom: 8px;
}

.audio-controls label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
}

.audio-controls label {
    color: #ccc;
    cursor: pointer;
}

.audio-controls input[type="checkbox"] {
    margin-right: 5px;
}

.audio-controls input[type="range"] {
    margin-left: 5px;
}

/* 覆蓋層樣式 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.overlay.hidden {
    display: none;
}

/* 畫面樣式 */
.screen {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 3px solid #00d4ff;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
    min-width: 400px;
}

.screen.hidden {
    display: none;
}

.screen-title {
    color: #00d4ff;
    font-size: 32px;
    margin-bottom: 20px;
    text-shadow: 0 0 15px #00d4ff;
}

.menu-options {
    margin-bottom: 20px;
}

.menu-item {
    padding: 12px 20px;
    margin: 8px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-size: 18px;
}

.menu-item:hover, .menu-item.selected {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
    color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.menu-hint {
    color: #999;
    font-size: 12px;
    margin-top: 20px;
}

.menu-hint a {
    color: inherit;
    text-decoration: underline;
}

/* 遊戲結束畫面 */
.final-stats {
    margin: 20px 0;
    padding: 20px;
    background: rgba(15, 52, 96, 0.3);
    border-radius: 8px;
}

.final-stats div {
    margin: 8px 0;
    font-size: 16px;
}

#name-input-section {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 170, 0, 0.1);
    border-radius: 8px;
    border: 1px solid #ffaa00;
}

#name-input-section label {
    color: #ffaa00;
    font-size: 14px;
}

#player-name-input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #0f3460;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    margin-left: 10px;
    font-family: inherit;
}

/* 排名畫面 */
.rankings-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
    padding-right: 6px;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    margin: 5px 0;
    background: rgba(15, 52, 96, 0.3);
    border-radius: 6px;
    border-left: 3px solid #0f3460;
}

.ranking-item.current {
    border-left-color: #ffaa00;
    background: rgba(255, 170, 0, 0.1);
}

.ranking-item.top3 {
    border-left-color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
}

.ranking-rank {
    color: #ffaa00;
    font-weight: bold;
    width: 30px;
}

.ranking-name {
    color: #ccc;
    flex: 1;
    text-align: left;
    margin-left: 10px;
}

.ranking-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 15px;
}

.ranking-tabs {
    display: flex;
    gap: 10px;
}

.ranking-tab {
    flex: 1;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid #0f3460;
    background: rgba(15, 52, 96, 0.4);
    color: #ccc;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ranking-tab.active {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
    color: #00d4ff;
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

.ranking-tab:active {
    transform: scale(0.97);
}

.ranking-caption {
    color: #ffaa00;
    font-size: 14px;
}

@media (max-width: 768px) {
    .rankings-list {
        max-height: 60vh;
    }
    .ranking-tab {
        font-size: 13px;
        padding: 9px 10px;
    }
    .ranking-caption {
        font-size: 13px;
    }
}

.ranking-score {
    color: #00d4ff;
    font-weight: bold;
    width: 80px;
    text-align: right;
}

.ranking-details {
    color: #999;
    font-size: 11px;
    width: 120px;
    text-align: right;
}

/* 按鈕樣式 */
button {
    background: linear-gradient(135deg, #0f3460, #1a1a2e);
    color: #00d4ff;
    border: 2px solid #00d4ff;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    transition: all 0.3s ease;
    margin: 5px;
}

button:hover {
    background: linear-gradient(135deg, #00d4ff, #0f3460);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

#submit-score {
    background: linear-gradient(135deg, #ffaa00, #ff8800);
    border-color: #ffaa00;
    color: #000;
}

#submit-score:hover {
    background: linear-gradient(135deg, #ff8800, #ffaa00);
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.5);
}

.final-rank-status {
    margin-top: 10px;
    font-size: 14px;
    color: #ffd369;
}

/* 響應式設計 */
@media (max-width: 1200px) {
    .main-game-area {
        gap: 10px;
        padding: 10px;
    }
    
    .left-panel, .right-panel {
        width: 150px;
        padding: 15px;
    }
    
    #game-canvas {
        width: 640px;
        height: 480px;
    }
}

/* 滾動條樣式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
    background: #0f3460;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00d4ff;
}
