* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
}

.container {
    text-align: center;
    padding: 20px;
    max-width: 600px;
    width: 100%;
}

/* 뒤로가기 버튼 */
.back-button {
    position: absolute;
    top: 20px;
    left: 20px;
}

.back-link {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    display: inline-block;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.screen {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hidden {
    display: none;
}

/* 난이도 선택 화면 */
.difficulty-buttons {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.difficulty-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 20px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
    touch-action: manipulation;
}

.difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.level-name {
    font-size: 1.4rem;
    font-weight: bold;
}

.level-desc {
    font-size: 0.9rem;
    opacity: 0.8;
}

.high-score-display {
    font-size: 0.8rem !important;
    color: #FFD700 !important;
    margin-top: 5px !important;
    font-weight: bold;
}

.tip {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 0.8rem;
    opacity: 0.8;
}

/* 게임 화면 */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.score-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: left;
}

.score, .difficulty, .high-score {
    font-size: 1.2rem;
    font-weight: bold;
}

.high-score {
    color: #FFD700;
    font-size: 1rem;
}

#gameCanvas {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    margin: 20px 0;
    max-width: 100%;
    height: auto;
}

.controls {
    margin-top: 20px;
}

.controls p {
    margin-bottom: 15px;
    opacity: 0.9;
}

.control-keys {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.key-row {
    display: flex;
    gap: 5px;
}

.arrow-key {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    touch-action: manipulation;
}

.arrow-key:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.arrow-key:active {
    transform: scale(0.95);
}

.control-btn {
    background: linear-gradient(45deg, #fd79a8, #e84393);
    border: none;
    border-radius: 25px;
    padding: 12px 25px;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(232, 67, 147, 0.4);
}

/* 게임 오버 화면 */
.final-score {
    margin: 20px 0;
    font-size: 1.2rem;
}

.final-score p {
    margin: 10px 0;
}

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

/* 새 기록 축하 메시지 */
#newRecord {
    animation: celebration 1s ease-in-out;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

@keyframes celebration {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* 반응형 디자인 */
@media (max-width: 480px) {
    .back-button {
        position: relative;
        top: 0;
        left: 0;
        margin-bottom: 20px;
    }
    
    .container {
        padding: 10px;
        padding-top: 0;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .screen {
        padding: 20px;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 350px;
    }
    
    .game-info {
        font-size: 1rem;
        justify-content: center;
        text-align: center;
        flex-direction: column;
        gap: 10px;
    }
    
    .score-info {
        text-align: center;
    }
    
    .game-over-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .tip {
        font-size: 0.7rem;
    }
    
    .arrow-key {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}
