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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #fff;
}

.game-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 900px;
    width: 100%;
    backdrop-filter: blur(10px);
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 2.5em;
    text-shadow: 0 2px 10px rgba(0, 255, 255, 0.5);
}

.score-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.score-box {
    background: rgba(0, 255, 255, 0.2);
    padding: 15px 25px;
    border-radius: 10px;
    min-width: 120px;
    border: 2px solid rgba(0, 255, 255, 0.3);
}

.score-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9em;
    font-weight: bold;
    margin-bottom: 5px;
}

.score-value {
    color: #00ffff;
    font-size: 1.5em;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

.game-info {
    text-align: center;
    margin-bottom: 20px;
}

.game-info p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 15px;
}

.start-btn, .try-again-btn, .save-btn, .fullscreen-btn {
    padding: 12px 30px;
    background: linear-gradient(45deg, #00ffff, #0080ff);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 255, 255, 0.3);
    margin: 5px;
}

.start-btn:hover, .try-again-btn:hover, .save-btn:hover, .fullscreen-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 255, 255, 0.5);
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

.fullscreen-btn {
    background: linear-gradient(45deg, #27ae60, #229954);
}


.canvas-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    background: #000;
    border-radius: 10px;
    padding: 10px;
    overflow: hidden;
    border: 2px solid rgba(0, 255, 255, 0.3);
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

canvas {
    border: 1px solid rgba(0, 255, 255, 0.5);
    display: block;
    background: #000;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lives-overlay {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 100;
    pointer-events: none;
}

.lives-display {
    display: flex;
    gap: 5px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid rgba(255, 68, 68, 0.5);
}

.heart {
    font-size: 24px;
    color: #ff4444;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.8);
    transition: transform 0.2s ease;
}

.heart.lost {
    opacity: 0.3;
    filter: grayscale(100%);
}

.score-overlay {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 100;
    pointer-events: none;
}

.score-display {
    background: rgba(0, 0, 0, 0.7);
    color: #00ffff;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid rgba(0, 255, 255, 0.5);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 255, 255, 0.3);
}

.score-display span {
    color: #ffff00;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.8);
}

.warning-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.2);
    z-index: 50;
    pointer-events: none;
    animation: warningPulse 0.5s ease-in-out infinite alternate;
}

@keyframes warningPulse {
    0% {
        background: rgba(255, 0, 0, 0.1);
    }
    100% {
        background: rgba(255, 0, 0, 0.3);
    }
}

.game-over {
    position: absolute;
    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;
}

.game-over-content {
    background: rgba(26, 26, 46, 0.95);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 255, 255, 0.3);
    border: 2px solid rgba(0, 255, 255, 0.3);
}

.game-over-content h2 {
    color: #ff4444;
    margin-bottom: 20px;
    font-size: 2em;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.8);
}

.game-over-content p {
    color: #fff;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.player-name-input {
    margin: 20px 0;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.player-name-input input {
    padding: 10px 15px;
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1em;
}

.player-name-input input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.controls-info {
    text-align: center;
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
}

.mobile-info {
    display: none;
    text-align: center;
    margin-top: 10px;
    color: rgba(0, 255, 255, 0.8);
    font-size: 0.9em;
}

.controls-info .mobile-controls {
    display: none;
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }
    
    .score-container {
        gap: 10px;
    }
    
    .score-box {
        min-width: 100px;
        padding: 10px 15px;
    }
    
    .mobile-info {
        display: block;
    }
    
    .game-info p:first-child {
        display: none;
    }
    
    .controls-info .desktop-controls {
        display: none;
    }
    
    .controls-info .mobile-controls {
        display: block;
    }
    
    #gameCanvas {
        touch-action: none;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    .canvas-wrapper {
        max-width: 100%;
        padding: 5px;
    }
}

/* 모바일 세로 화면 (Portrait) */
@media (max-width: 768px) and (orientation: portrait) {
    .game-container {
        padding: 15px;
        max-width: 100%;
    }
    
    h1 {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    
    .score-container {
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .score-box {
        min-width: 80px;
        padding: 8px 12px;
        font-size: 0.9em;
    }
    
    .score-value {
        font-size: 1.2em;
    }
    
    .game-info {
        margin-bottom: 15px;
    }
    
    .button-group {
        gap: 8px;
    }
    
    .start-btn, .fullscreen-btn {
        padding: 10px 20px;
        font-size: 0.9em;
    }
    
    .canvas-wrapper {
        padding: 5px;
        margin: 0 auto;
    }
    
    canvas {
        width: 100% !important;
        max-width: 100%;
        height: auto !important;
    }
    
    .lives-overlay {
        top: 10px;
        left: 10px;
    }
    
    .score-overlay {
        top: 10px;
        right: 10px;
    }
    
    .score-display {
        font-size: 14px;
        padding: 6px 12px;
    }
    
    .lives-display {
        padding: 6px 10px;
    }
    
    .heart {
        font-size: 20px;
    }
    
    .controls-info {
        margin-top: 15px;
        font-size: 0.85em;
    }
}

/* 모바일 가로 화면 (Landscape) */
@media (max-width: 768px) and (orientation: landscape) {
    .game-container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.8em;
        margin-bottom: 10px;
    }
    
    .score-container {
        gap: 10px;
        margin-bottom: 10px;
    }
    
    .game-info {
        margin-bottom: 10px;
    }
    
    .canvas-wrapper {
        padding: 5px;
    }
    
    canvas {
        max-height: 70vh;
        width: auto !important;
        height: auto !important;
    }
}
