body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #000;
    font-family: 'Courier New', Courier, monospace;
    user-select: none;
    -webkit-user-select: none;
}

canvas {
    display: block;
}

/* 로딩 화면 스타일 */
#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

#loading-text {
    font-size: 30px;
    font-weight: bold;
    margin-bottom: 20px;
    animation: blink 1s infinite alternate;
}

#loading-bar-container {
    width: 300px;
    height: 30px;
    border: 4px solid #fff;
    padding: 3px;
    border-radius: 5px;
}

#loading-bar {
    width: 0%;
    height: 100%;
    background: #00ffcc;
    transition: width 0.1s linear;
}

/* 시작 화면 스타일 */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://i.ibb.co/k6s7GWCD/image.png') no-repeat center center;
    background-size: cover;
    z-index: 20;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

#start-logo {
    max-width: 80%;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(4px 4px 4px rgba(0,0,0,0.8));
}

#start-desc {
    font-size: 18px;
    color: #eee;
    margin-bottom: 40px;
    text-align: center;
    line-height: 1.5;
    text-shadow: 2px 2px 4px #000;
    font-weight: bold;
}

/* 버튼 공통 스타일 */
.menu-btn {
    padding: 15px 40px;
    font-size: 24px;
    background: #fff;
    color: #000;
    border: 4px solid #ff4444;
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    transition: transform 0.1s, background 0.2s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    margin: 10px 0;
    width: 250px;
    text-align: center;
}

.menu-btn:hover {
    background: #ffcccc;
    transform: scale(1.05);
}

/* 설정 화면 스타일 */
#settings-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 30;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

.settings-row {
    margin: 20px 0;
    width: 80%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.settings-label {
    font-size: 20px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 0 #000;
}

/* 슬라이더 커스텀 */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    height: 15px;
    border-radius: 5px;
    background: #333;
    outline: none;
    border: 2px solid #fff;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #00ffcc;
    cursor: pointer;
    border: 2px solid #000;
}

/* 레벨업 모달 스타일 */
#level-up-modal {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    overflow: hidden;
}

/* 레벨업 캐릭터 이미지 스타일 */
#levelup-char {
    position: absolute;
    bottom: 0;
    right: -1000px;
    height: 90%;
    max-width: 60%;
    object-fit: contain;
    z-index: 1;
    pointer-events: none;
    transition: right 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
}

#levelup-char.active {
    right: -50px;
    opacity: 1;
}

#level-up-title {
    font-size: 40px;
    color: #ffd700;
    margin-bottom: 30px;
    text-shadow: 2px 2px 0 #000;
    position: relative;
    z-index: 2;
}

.card-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.card {
    border: 2px solid #fff;
    padding: 20px;
    width: 220px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
}

.card.stat {
    background: rgba(34, 34, 34, 0.9);
}

.card.stat:hover {
    background: #333;
    border-color: #ffd700;
    transform: translateY(-10px);
}

.card.weapon {
    background: rgba(90, 42, 42, 0.9);
    border-color: #ff8888;
}

.card.weapon:hover {
    background: #7a3a3a;
    border-color: #ffcccc;
    transform: translateY(-10px);
}

.card-type {
    font-size: 10px;
    text-transform: uppercase;
    margin-bottom: 5px;
    color: #aaa;
    letter-spacing: 1px;
}

.card-icon {
    font-size: 40px;
    margin-bottom: 15px;
    display: block;
}

.card-name {
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 5px;
    display: block;
}

.card-level {
    font-size: 14px;
    color: #00ffcc;
    margin-bottom: 10px;
    font-weight: bold;
    display: block;
}

.card-desc {
    font-size: 12px;
    color: #ccc;
    line-height: 1.4;
    display: block;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    padding: 20px;
    box-sizing: border-box;
    z-index: 5;
}

#xp-bar-bg {
    width: 100%;
    height: 20px;
    background: #333;
    border: 2px solid #000;
    margin-top: 10px;
}

#xp-bar-fill {
    width: 0%;
    height: 100%;
    background: #00ff00;
    transition: width 0.2s;
}

/* 게임 오버 화면 스타일 */
#game-over-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://i.ibb.co/SDN6JTjW/image.png') no-repeat center center;
    background-size: cover;
    z-index: 100;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#game-over-screen.active {
    display: flex !important;
}

#game-over-title {
    font-size: 60px;
    color: #ff0000;
    font-weight: bold;
    text-shadow: 4px 4px 0 #000, -2px -2px 0 #fff;
    margin-bottom: 20px;
    text-align: center;
    width: 100%;
    animation: blink 1s infinite alternate;
}

#game-over-desc {
    font-size: 24px;
    color: white;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
    margin-top: 200px;
    cursor: pointer;
    text-align: center;
    width: 100%;
    animation: pulse 1s infinite;
}

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

#stampede-warning {
    display: none;
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff0000;
    font-size: 40px;
    font-weight: bold;
    text-shadow: 2px 2px 0 #fff, 0 0 10px #ff0000;
    z-index: 40;
    text-align: center;
    animation: blink 0.5s infinite alternate;
    width: 100%;
}

@keyframes blink {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* 조이스틱 스타일 */
#joystick-zone {
    position: absolute;
    bottom: 50px;
    right: 50px;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    z-index: 50;
    touch-action: none;
    display: none;
}

#joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
