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

body {
    overflow: hidden;
    font-family: Arial, sans-serif;
}

#container {
    width: 100vw;
    height: 100vh;
}

#instructions {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px;
    border-radius: 10px;
    z-index: 100;
}

#instructions h2 {
    margin-bottom: 10px;
    font-size: 18px;
}

#instructions p {
    margin: 5px 0;
    font-size: 14px;
}

#item-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px 30px;
    border-radius: 15px;
    border: 2px solid #4CAF50;
    z-index: 200;
    text-align: center;
    min-width: 200px;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
}

#item-popup h3 {
    margin-bottom: 10px;
    font-size: 20px;
    color: #4CAF50;
}

#item-popup p {
    margin: 5px 0;
    font-size: 14px;
}

.hidden {
    display: none !important;
}

/* 모바일 컨트롤 */
#mobile-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 300;
}

.control-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.direction-pad {
    display: grid;
    grid-template-columns: repeat(3, 60px);
    grid-template-rows: repeat(3, 60px);
    gap: 5px;
}

.control-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    color: white;
    font-size: 24px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.control-btn:active {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0.95);
}

.control-btn.up { grid-column: 2; grid-row: 1; }
.control-btn.left { grid-column: 1; grid-row: 2; }
.control-btn.right { grid-column: 3; grid-row: 2; }
.control-btn.down { grid-column: 2; grid-row: 3; }

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-btn {
    width: 70px;
    height: 70px;
    background: rgba(76, 175, 80, 0.5);
    border: 2px solid rgba(76, 175, 80, 0.8);
    border-radius: 50%;
    color: white;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.action-btn:active {
    background: rgba(76, 175, 80, 0.7);
    transform: scale(0.95);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    #instructions {
        top: 10px;
        left: 10px;
        right: 10px;
        padding: 10px;
        font-size: 12px;
    }
    
    #instructions h2 {
        font-size: 16px;
        margin-bottom: 5px;
    }
    
    #instructions p {
        font-size: 11px;
        margin: 3px 0;
    }
    
    #item-popup {
        min-width: 150px;
        padding: 15px 20px;
    }
    
    #item-popup h3 {
        font-size: 16px;
    }
    
    #item-popup p {
        font-size: 12px;
    }
    
    #mobile-controls {
        display: block;
    }
    
    .direction-pad {
        grid-template-columns: repeat(3, 50px);
        grid-template-rows: repeat(3, 50px);
    }
    
    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .action-btn {
        width: 60px;
        height: 60px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    #instructions {
        padding: 8px;
    }
    
    #instructions h2 {
        font-size: 14px;
    }
    
    #instructions p {
        font-size: 10px;
    }
    
    .direction-pad {
        grid-template-columns: repeat(3, 45px);
        grid-template-rows: repeat(3, 45px);
    }
    
    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .action-btn {
        width: 55px;
        height: 55px;
        font-size: 11px;
    }
}

/* 업로드 버튼 */
.upload-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(76, 175, 80, 0.8);
    color: white;
    border: 2px solid rgba(76, 175, 80, 1);
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    z-index: 400;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.upload-btn:active {
    background: rgba(76, 175, 80, 1);
    transform: scale(0.95);
}

/* 업로드 팝업 */
#upload-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.upload-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 90%;
    width: 400px;
    text-align: center;
}

.upload-content h3 {
    margin-bottom: 20px;
    color: #333;
}

#file-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.upload-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:active {
    background: #45a049;
    transform: scale(0.95);
}

.btn-secondary {
    background: #f44336;
    color: white;
}

.btn-secondary:active {
    background: #da190b;
    transform: scale(0.95);
}

#upload-status {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
}

#upload-status.success {
    color: #4CAF50;
}

#upload-status.error {
    color: #f44336;
}

@media (max-width: 768px) {
    .upload-btn {
        top: 10px;
        right: 10px;
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .upload-content {
        padding: 20px;
        width: 90%;
    }
    
    .upload-content h3 {
        font-size: 18px;
    }
    
    .btn-primary, .btn-secondary {
        padding: 10px 20px;
        font-size: 14px;
    }
}